PHP code example of wcr / crud

1. Go to this page and download the library: Download wcr/crud library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wcr / crud example snippets




namespace App;

use Wcr\Crud\Rolify;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;
    use Rolify;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
}



namespace App\Http\Controllers;

use App\Post;
use Wcr\Crud\Http\CrudController;

class PostController extends CrudController
{
    
    public $modelClass = 'App\Post'; // REQUIRED to define the model class

    public $acceptedAttributes = array( 'title', 'body' ); // REQUIRED to define accepted attributes by form

    public $validateRules = array( 'title' => '



namespace App;

use Illuminate\Database\Eloquent\Model;
use Wcr\Crud\Entitize;

class Post extends Model
{
    use Entitize;
}

$ composer san vendor:publish --tag=migrations
$ php artisan migrate
$ php artisan vendor:publish --tag=abilities

$ php artisan make:auth