/laravel-finer

Laravel multi-purpose helpers

Primary LanguagePHPMIT LicenseMIT

Laravel Finer

Latest Version on Packagist Total Downloads

This package introduces set of multi-purpose helper classes that provides a new way of organising the logic of your Laravel applications.

Installation

You can install the package via composer:

$ composer require rjchauhan/laravel-finer

Usage

Action

Keep your Laravel applications DRY with single action classes.

use Rjchauhan\LaravelFiner\Action\Action;

class DeactivateUser extends Action
{
    protected function canBePerformed()
    {
        return $this->model->is_active;
    }

    protected function perform()
    {
        $this->model->is_active = false;

        $this->model->save();
    }
}

Usage

class UserActivationController extends Controller
{
    public function deactivate(User $user)
    {
        $user = (new DeactivateUser($user))->execute();

        return UserResource::make($user);
    }
}

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email Raviraj Chauhan instead of using the issue tracker.

Credits

License

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