PHP code example of jeanlrnt / laravel-cancellable

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

    

jeanlrnt / laravel-cancellable example snippets


Schema::create('posts', function (Blueprint $table) {
    $table->id();
    $table->unsignedBigInteger('user_id');
    $table->string('title');
    $table->timestamps();
    $table->cancelledAt(); // Macro
});

$user = User::first();
$user->cancel();
$user->unCancel();

$usersWithCanceled = User::query()->withCanceled();
$onlyCanceledUsers = User::query()->onlyCanceled();