PHP code example of daniel-de-wit / laravel-model-active

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

    

daniel-de-wit / laravel-model-active example snippets




use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddActiveModelSupportToArticleTable extends Migration
{
    public function up()
    {
        Schema::create('article', function (Blueprint $table) {
            $table->boolean('active')->default(true)->index();
        });
    }
    
    public function down()
    {
        Schema::table('article', function (Blueprint $table) {
            $table->dropColumn('active');
        });
    }
}



class MyModel extends Eloquent
{
    use Active;

    ...

}



    MyModel::withoutGlobalScope(ActiveScope::class)->get();