1. Go to this page and download the library: Download brnbio/laravel-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/ */
brnbio / laravel-crud example snippets
// AppServiceProvider.php
GenerateRequestCommand::macro('updateReplace', function (array $replace, array $arguments, array $options) {
return array_merge($replace, [
// your replacements
]);
});
// e.g. for a Team model
$replace = [
'namespace' => 'App\Models',
'rootNamespace' => 'App',
'class' => 'Team',
'namespacedModel' => 'App\Models\Team',
'model' => 'Team',
'modelVariable' => 'team',
'modelVariablePlural' => 'teams',
];
// generated fields
/**
* Class Team
*
* @package App\Models
* @property string $name
*/
class Team extends Model
{
public const TABLE = 'teams';
public const ATTRIBUTE_NAME = 'name';
/**
* @var string[]
*/
protected $fillable = [
self::ATTRIBUTE_NAME,
];
}