PHP code example of wowe / laravel-eloquent-scopes
1. Go to this page and download the library: Download wowe/laravel-eloquent-scopes 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/ */
wowe / laravel-eloquent-scopes example snippets
use Wowe\Eloquent\Scopes\ActivatableTrait;
class Test extends \Eloquent
{
use ActivatableTrait;
const ACTIVE = 'is_active';
}
// Get all entries that are active
Test::all();
// Get a single entry only if active
Test::find(1);
// Get all entries
Test::withInactive()->get();
// Get all inactive entries
Test::inactiveOnly()->get();