PHP code example of gerson / laravel-base

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

    

gerson / laravel-base example snippets

 ^8.1

'providers' => [ ...

gersonalves\laravelBase\BaseLaravelServiceProvider::class

use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

use AuthorizesRequests, DispatchesJobs, ValidatesRequests, ControllerTrait;

use gersonalves\laravelBase\Traits\ControllerTrait;

public function scopeWithRelations(Illuminate\Database\Eloquent\Builder $query)
{
    return $query->with(['address', 'people']);
}
 
  protected ?array $validators = [
        'email' => ''cpf' => '
 
  protected ?array $replaceOnUpdate = [
        'email' => '
 
protected ?array $excludeOnUpdate = ['cpf', 'password'];
 
  public function store(Request $request)
    {
        $eventAddress = new EventAddressRepository();
        $address = $eventAddress->store(new Request($request->get('event_address')));
        $request = $this->mergeRequest($request, ['id_event_address' => $address['id_event_address']]);
        $events = $this->repository->store($request);
        return array_merge($events, ['event_address' => $address]);
    }
 
 protected ?array $parentStore = [
        EventAddressService::class => 
        [
          'persist' => PersistEnum::BEFORE_PERSIST,
          'callback' => 'NomeDaFuncaoDoCallBack'
        ]
    ];
    
    public function NomeDaFuncaoCallBack($model){
      
    }
 
protected ?array $storeFile = [
  'logo' => [
    'type' => fileEnum::BASE64_IMAGE,
    'path' => 'public/'
  ]
];
bash
config/app.php
bash
php artisan larabase:resource