PHP code example of moffhub / maker-checker

1. Go to this page and download the library: Download moffhub/maker-checker 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/ */

    

moffhub / maker-checker example snippets


use Moffhub\MakerChecker\Traits\ChecksRequests;

class Post extends Model
{
    use ChecksRequests;
}

 if (auth()->user()->lRequest = MakerChecker::request()
                ->toExecute(
                    $approvableActionClass,
                    (array) $data,
                )
                ->madeBy(auth()->user())
                ->description('Create Posts')
                ->save();

            return MakerCheckerResource::make($approvalRequest)
                ->format(MakerCheckerResource::SIMPLE)
                ->response()
                ->setStatusCode(Response::HTTP_MULTI_STATUS);
        }

MakerChecker::request()->toExecute(
                    $approvableActionClass,
                    (array) $data,
                    [
                        'admin'=> 2,
                        'client' => 3,
                    ],
                )

MakerChecker::request()->toCreate(
                    $createActionClass,
                    (array) $data,
                )

MakerChecker::request()->toUpdate(
                    $updateActionClass,
                    (array) $data,
                )

MakerChecker::request()->toDelete(
                    $deleteActionClass,
                    (array) $data,
                )
bash 
php artisan vendor:publish --provider="Moffhub\MakerChecker\MakerCheckerServiceProvider" --tag="config"