PHP code example of pascalvgemert / laravel-lookupable
1. Go to this page and download the library: Download pascalvgemert/laravel-lookupable 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/ */
pascalvgemert / laravel-lookupable example snippets
$draftStatus = Status::lookup('draft'); // Executes the select * query and puts all instances in memory
$publishedStatus = Status::lookup('published'); // Will get the instance from memory
$deletedStatus = Status::lookup('deleted'); // Will get the instance from memory
class Role extends \Illuminate\Database\Eloquent\Model
{
use Lookupable/Lookupable;
}
class Country extends \Illuminate\Database\Eloquent\Model
{
use Lookupable/Lookupable;
protected $lookupColumn = 'code';
}