# Installation

All you need to do to get started is add Laravel Action to your composer dependencies.

composer require lorisleiva/laravel-actions

You can then use the make:action artisan command to create your first action.

php artisan make:action MyFirstAction

This will create the following class in your repository.

namespace App\Actions;

use Lorisleiva\Actions\Action;

class MyFirstAction extends Action
{
    /**
     * Determine if the user is authorized to make this action.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the action.
     *
     * @return array
     */
    public function rules()
    {
        return [];
    }

    /**
     * Execute the action and return a result.
     *
     * @return mixed
     */
    public function handle()
    {
        // Execute the action.
    }
}
Last Updated: 12/23/2020, 10:16:19 AM