PHP code example of rafahsborges / eloquent-model-generator
1. Go to this page and download the library: Download rafahsborges/eloquent-model-generator 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/ */
rafahsborges / eloquent-model-generator example snippets
class PerPageProcessor implements ProcessorInterface
{
public function process(EloquentModel $model, Config $config): void
{
$propertyModel = new PropertyModel('perPage', 'protected', 20);
$dockBlockModel = new DocBlockModel('The number of models to return for pagination.', '', '@var int');
$propertyModel->setDocBlock($dockBlockModel);
$model->addProperty($propertyModel);
}
public function getPriority(): int
{
return 8;
}
}
public function register()
{
$this->app->tag([InflectorRulesProcessor::class], [GeneratorServiceProvider::PROCESSOR_TAG]);
}
/**
* The number of models to return for pagination.
*
* @var int
*/
protected $perPage = 20;
php artisan rafahsborges:generate:model User
php artisan rafahsborges:generate:model User --table-name=user
php artisan rafahsborges:generate:model User --base-class-name=Custom\\Base\\Model
php artisan rafahsborges:generate:model User --no-backup
php artisan rafahsborges:generate:model User
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.