PHP code example of digikraaft / laravel-model-suspension

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

    

digikraaft / laravel-model-suspension example snippets


use Digikraaft\ModelSuspension\CanBeSuspended;
use Illuminate\Database\Eloquent\Model;

class EloquentModel extends Model
{
    use CanBeSuspended;
}
bash
php artisan vendor:publish --provider="Digikraaft\ModelSuspension\ModelSuspensionServiceProvider" --tag="migrations"

php artisan migrate

php artisan vendor:publish --provider="Digikraaft\ModelSuspension\ModelSuspensionServiceProvider" --tag="config"

namespace Digikraaft\ModelSuspension\Events;

use Digikraaft\ModelSuspension\Suspension;
use Illuminate\Database\Eloquent\Model;

class ModelSuspensionChanged
{
    /** @var \Digikraaft\ModelSuspension\Suspension */
    public Suspension $suspension;

    /** @var \Illuminate\Database\Eloquent\Model */
    public Model $model;

    public function __construct(Model $model, Suspension $suspension)
    {
        $this->suspension = $suspension;
        $this->model = $model;
    }
}