Download

Admin Architect

Admin Architect is a framework for creating administration interfaces. It's like ActiveAdmin for Laravel.

It helps developers to implement beautiful and elegant admin interfaces with very little effort.

Installation

As you always do, install composer package:

composer require adminarchitect/core

Once the package installed, register its service provider in config/app.php file. (Ignore this step if you use Laravel 5.5)

'providers' => [
    ...
    Terranet\Administrator\ServiceProvider::class,
	...
]

Publish package's assets, translation and configuration by running:

php artisan administrator:publish

it will copy adminarchitect's assets to a resources/assets/administrator directory.

All views will be copied to a resources/views/vendor/administrator directory.

AdminArchitect assets are provided in ES6 and less/sass formats, so to convert them to a js/css there is a NPM package adminarchitect/mix.

First we need to do is to install node dependencies (if you didn't do this before) by runing:

mpm i

then let's install adminarchitect-mix:

npm i adminarchitect/mix --save-dev

Next step is to register AdminMix tasks, so add these lines to your webpack.mix.js:

const AdminMix = require('adminarchitect-mix');

(new AdminMix).handle();

then you can run any of these commands:

npm run [dev|production|watch]

to build assets.

You'll find the generated assets in the public/admin directory.

Migrations

if you're running a fresh Laravel installation, run:

php artisan migrate

Create administrator

Before logging in, let's create a new SuperAdmin user:

artisan administrator:create

AdminArchitect needs almost no other configuration out of the box.

You are free to get started developing!

However, you may wish to review the config/administrator.php file and its contents.

It contains several options that you might wish to change according to your business requirements.

Let's review some of them:

# authentication options
'auth' => [
	'identity' => 'email',
	'credential' => 'password',
	'model' => \App\User::class,
	'conditions' => null,
],
  • If you want to use different model to authenticate your users (for inst.: \App\Admin) - you can change it here.
  • Or maybe the main identity you want to use is username rather than email.
  • If there is a case to limit users who can login to admin by adding some additional login criterias - use conditions. So for instance the only users who have specific role in your database can login, your conditions might look like:
	...
	'conditions' => [
		'role' => 'admin'
	]
	...

User::isSuperAdmin

'permission' => \Terranet\Administrator\Auth\SuperAdminRule::class,

By default AdminArchitect uses a convention that only user with id === 1 is a super admin. You can change this approach by adding a method to your 'auth.model' class, called isSuperAdmin().

Ex.: based on previous example with role, your User::isSuperAdmin() might look like:

public function isSuperAdmin()
{
	return $this->role === 'admin';
}

or based on some 3rd party ACL packages, like zizaco/entrust:

public function isSuperAdmin()
{
	return $this->hasRole('admin');
}

Paths

All Admin Architect related services, actions, savers, finders will be saved in these directories.

'paths' => [
	...
]

Passwords Manager

'manage_passwords' => true

Out of the box for admin area, Admin Architect listens for User::saving() event to handle passwords in a right way - in other words, converts plain text to a hash.

If you find this feature unnecessary - just set it to false.

Factories

# Navigation factory
'menu' => \Terranet\Administrator\Navigation\Factory::class,

# Dashboard factory
'dashboard' => \App\Http\Terranet\Administrator\Dashboard\Factory::class,