patilvishalvs/generic_crud

A generic crud for MVC in laravel

v1.3 2019-08-19 11:44 UTC

This package is auto-updated.

Last update: 2024-09-19 23:33:00 UTC


README

Create new Laravel Project

laravel new <project_name>

Install package

composer require patilvishalvs/generic_crud

Update default string length in AppServiceProvider.php:

//Add following line in AppServiceProvider.php
use Illuminate\Support\Facades\Schema;
...
public function boot()
{
    ...
    //Add following line in boot() function of AppServiceProvider.php
    Schema::defaultStringLength(191);
}

Migrate database and enable auth

php artisan migrate
php artisan make:auth

Update User.php file with following lines to enable ACL:

// Use class HasRolesTrait
use PatilVishalVS\GenericCRUD\HasRolesTrait;
...
//Add trait to User model as follow
...
use Notifiable, HasRolesTrait;

Register new middleware in Kernel.php

protected $routeMiddleware = [
  ...
    'generic_crud' => \PatilVishalVS\GenericCRUD\GenericAuthMiddleware::class,
];

Seed and Publish vendor resources and assets then serve

php artisan db:seed --class="PatilVishalVS\GenericCRUD\seeds\DatabaseSeeder"
php artisan vendor:publish --tag=public
php artisan vendor:publish --tag=resources
php artisan serve