PHP code example of markofly / admincrud

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

    

markofly / admincrud example snippets


'providers' => [
  ...
  Markofly\AdminCrud\AdminCrudServiceProvider::class,
],



return [
    'path' => base_path('config/markofly/forms/'),
];


return [
    'model' => App\User::class, // Model class for forms
    'route_name' => 'users', // Resource route prefix
    'per_page' => 5, // Per page number for list view
    'create_form' => [...], // Create form fields
    'edit_form' => [...], // Edit form fields
    'list' => [...], // List view fields
];

[
    'label' => 'Password', // Label for fields
    'type' => 'password', // Field type Currently available: text, password, textarea, checkbox, checkboxes, radio, select
    'multiple_data' => [ // Used only for radio, checkboxes, select
        [
            'label' => 'First label',
            'value' => 'first',
        ],
    ],    
    'name' => 'password', // Field name
    'database_field' => 'password', // false for non database field; Database field name
    'validation_rules' => '

[
    'label' => 'Full name', // Label for fields
    'type' => 'text', // Field type Currently available: text, password, textarea, checkbox, checkboxes, radio, select
    'multiple_data' => [ // Used only for radio, checkboxes, select
        [
            'label' => 'First label',
            'value' => 'first',
        ],
    ], 
    'name' => 'name', // Field name
    'database_field' => 'name', // false for non database field; Database field name
    'validation_rules' => '

[
    'label' => 'Full name', // Field label
    'database_field' => 'name', // Database field name
],


namespace App\Http\Controllers;

use Markofly\AdminCrud\AdminCrud;
use Markofly\AdminCrud\AdminCrudTrait;

class UsersController extends Controller
{
    use AdminCrudTrait;

    public function initializeAdminCrud()
    {
        $this->adminCrud = new AdminCrud('users');
        $this->pageTitle = 'Users';
    }
}

Route::resource('users', 'UsersController');
bash
$ php artisan vendor:publish --provider="Markofly\AdminCrud\AdminCrudServiceProvider"
bash
$ php artisan make:controller UsersController