PHP code example of statix-php / laravel-form-actions
1. Go to this page and download the library: Download statix-php/laravel-form-actions 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/ */
statix-php / laravel-form-actions example snippets
namespace App\Actions;
use Statix\FormAction\FormAction;
class ActionName extends FormAction
{
public function authorized(): bool
{
return true;
}
public function handle()
{
// Do cool things, tell people - Aaron Francis
}
}
namespace App\Actions;
use App\Models\User;
use Statix\FormAction\FormAction;
use Statix\FormAction\Validation\Rules;
class ActionName extends FormAction
{
#[Rules(['eturn true;
}
public function handle(): User
{
return User::create([
'name' => $this->name,
'email' => $this->email,
'timezone' => $this->timezone ?? 'UTC',
]);
}
}