bekwoh/laravel-action

Simple Actionable for Laravel

Downloads

657

Stars

5

Version

1.2.0

This package has been archived

Simple Actionable for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Simple Actionable for Laravel.

Installation

You can install the package via composer:

composer require bekwoh/laravel-action

You can publish the config file with:

php artisan vendor:publish --tag="laravel-action-config"

Optionally, you can publish the views using

Usage

php artisan make:action User\\CreateOrUpdateUser --model=User

This will create an action in app\Actions\User:

<?php

namespace App\Actions\User;

use App\Models\User;
use Bekwoh\LaravelAction\AbstractAction as Action;

class CreateOrUpdateUser extends Action
{
    public $model = User::class;

    public function rules(): array
    {
        return [];
    }
}

Then you can use it like:

use App\Actions\User\CreateOrUpdateUser;

$user = (new CreateOrUpdateUser(['name' => 'Nasrul Hazim', 'email' => '[email protected]']));

// do more with \App\Models\User object
// $user->assignRole(...)

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

bekwoh

Author

bekwoh