PHP code example of orebarranco / filament-ddd-starter

1. Go to this page and download the library: Download orebarranco/filament-ddd-starter 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/ */

    

orebarranco / filament-ddd-starter example snippets


// app/Filament/Resources/Users/Pages/CreateUser.php
protected function handleRecordCreation(array $data): Model
{
    return resolve(CreateUserAction::class)->execute(UserData::fromArray($data));
}

public function store(StoreUserRequest $request): JsonResource
{
    $user = resolve(CreateUserAction::class)->execute(UserData::fromArray($request->validated()));

    return new UserResource($user);
}

public function execute(UserData $data): User               // CreateUserAction
public function execute(User $user, UserData $data): User   // UpdateUserAction
public function execute(User $user): bool                   // DeleteUserAction
bash
php artisan shield:generate --resource=NombreResource --panel=admin --no-interaction
php artisan shield:seeder --force --no-interaction
bash
php artisan domain:make NombreDominio