PHP code example of rjchauhan / laravel-finer

1. Go to this page and download the library: Download rjchauhan/laravel-finer 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/ */

    

rjchauhan / laravel-finer example snippets


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();
    }
}

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

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