PHP code example of kabbouchi / laravel-bread

1. Go to this page and download the library: Download kabbouchi/laravel-bread 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/ */

    

kabbouchi / laravel-bread example snippets


Bread::routes('users');
// or specify a custom controller
Bread::routes('users','UsersController');


use App\User;
use KABBOUCHI\Bread\Http\BreadType;
use KABBOUCHI\Bread\Http\Controllers\Traits\Bread;

class UsersController extends controller
{
    use Bread;
    
    protected function model()
    {
        return User::class;
    }

    public function getFieldOptions(Model $model)
    {
        return [
            'avatar'      => [
                'type'              => BreadType::IMAGE,
                'validation'        => ['         'password'    => [
                'type'       => BreadType::PASSWORD,
                'validation' => ['-table-view
     */
    public function getTableFields()
    {
        return [
            'ID'         => 'id',
            'Name'       => 'name',
            'Role'       => 'role.name',
            'Created At' => function (User $model) {
                return $model->created_at->toDateString();
            },
        ];
    }
}

bash
php artisan make:bread UsersController User