wislem/scaffenger

Installs: 33

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 1

Open Issues: 0

Language:JavaScript

0.6.6 2015-06-12 08:00 UTC

This package is not auto-updated.

Last update: 2024-11-23 18:44:29 UTC


README

A scaffolding generator for any database setup ;)

It has its own UI (can be swapped with any custom made template).

Supports a total of 17 column types including:

Installation steps

Step 1: Install package

Add the package inside your composer.json requirements:

composer require wislem/scaffenger

Add the ServiceProvider to your config/app.php file:

'Wislem\Scaffenger\ScaffengerServiceProvider',

In the User class, add the ShinobiTrait:

use Pingpong\Traits\TrustyTrait;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract {

	use Authenticatable, CanResetPassword, TrustyTrait;
	
	// ...
}

Step 2: Publish

php artisan vendor:publish

This will publish the following:

  • Config files
  • Migrations
  • Seeds
  • Assets
  • Views

Step 3: Run migrations and seeds

Add seeds to your main DatabaseSeeder class

<?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class DatabaseSeeder extends Seeder {

	/**
	 * Run the database seeds.
	 *
	 * @return void
	 */
	public function run()
	{
		Model::unguard();
		
		$this->call('PermissionTableSeeder');
		$this->call('RoleTableSeeder');
		$this->call('UserTableSeeder');
	}

}

Migrate and seed:

php artisan migrate
php artisan db:seed
composer dump-autoload

That last command is so that Scaff's seeders will be autoloaded.

Result of the above actions

  • DB tables: users, password_resets (default Laravel migration) permissions, roles, permission_role, role_user (Pingpong\Trusty migrations) media, tests (Scaffenger's migrations)
  • Seeds

Step 4

Navigate to /admin and play around.

What now?

Create your db table config files inside

/config/scaffenger/tables

based on

/config/scaffenger/tables/guide.php

E.g.

/config/scaffenger/tables/pages.php

and then you can navigate to

/admin/list/pages

to manage your db table through the UI.

Don't forget to add your newly created scaffold to the menu

/config/scaffenger/config.php

Set your own custom controller for Scaffenger's custom actions like so:

Create your custom controller in your app/Http/Controllers

<?php namespace App\Http\Controllers;

class CustomScaffengerController extends Controller {

  public function __construct()
  {
    $this->middleware('scaffenger.auth');
  }

  public function yourCustomAction(){
    //
  }

}

and set the route in /config/scaffenger/config.php