PHP code example of webfactor / laravel-generators

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

    

webfactor / laravel-generators example snippets


public $validationRule; // ' [
    'type' => 'string', // any type available for a migration file
    // optional:
    // 'unique' => true
    // 'default' => 'value'
    // 'nullable' => true
    // etc.
];

public $crudColumn = [
    'type' => 'text', // or date, number, any backpack column
    // 'label' => 'Name of label'
    // ... any option
];

public $crudField = [
    'type' => 'text', // or date, number, any backpack field
    // 'label' => 'Name of label'
    // ... prefix, suffix... any option
];



namespace Webfactor\Laravel\Generators\Schemas\Naming;

use Webfactor\Laravel\Generators\Contracts\NamingAbstract;

class CrudController extends NamingAbstract
{
    /**
     * @return string
     */
    public function getNamespace(): string
    {
        return $this->getAppNamespace() . 'Http\\Controllers\\Admin';
    }

    /**
     * @return string
     */
    public function getClassName(): string
    {
        return ucfirst($this->entity) . 'CrudController';
    }

    /**
     * @return string
     */
    public function getFileName(): string
    {
        return $this->getClassName() . '.php';
    }

    /**
     * @return string
     */
    public function getPath(): string
    {
        return app_path('Http/Controllers/Admin');
    }

    /**
     * @return string
     */
    public function getStub(): string
    {
        return __DIR__ . '/../../../stubs/crud-controller.stub';
    }
}



namespace Webfactor\Laravel\Generators\Services;

class MyService extends ServiceAbstract implements ServiceInterface
{
    protected $key = 'myNaming';

    protected function call()
    {
        echo $this->naming;
        // same to
        echo $this->command->naming['myNaming'];
        // but you can additionally access
        echo $this->command->naming['otherNaming'];
    }
}
 bash
php artisan make:entity {entity_name} {--schema=} {--migrate} {--ide=} {--git} 
 bash
php artisan vendor:publish --provider="Webfactor\Laravel\Generators\GeneratorsServiceProvider"