PHP code example of signifly / laravel-manageable

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

    

signifly / laravel-manageable example snippets


// 1. Add reate('orders', function (Blueprint $table) {
    // ...
    $table->manageable();

    // params: $bigIntegers (default: true), $foreignTable (default: 'users'), $foreignKey (default: 'id')
    $table->manageable(false, 'some_users_table', 'u_id');
});

// 2. Add the Manageable trait to your model
class Order extends Model
{
    use Manageable;
}

$this->unsignedBigInteger('created_by')->nullable()->index();
$this->unsignedBigInteger('updated_by')->nullable()->index();

$this->foreign('created_by')
    ->references('id')
    ->on('users')
    ->onDelete('set null');

$this->foreign('updated_by')
    ->references('id')
    ->on('users')
    ->onDelete('set null');
bash
php artisan vendor:publish --provider="Signifly\Manageable\ManageableServiceProvider"