PHP code example of rasyidly / laravel-model-query
1. Go to this page and download the library: Download rasyidly/laravel-model-query 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/ */
rasyidly / laravel-model-query example snippets
use Rasyidly/ModelQuery/ModelQuery;
class User extends Model
{
/**
* This will load Loadable, Searchable, Sortable, and Trashable Traits in single load.
*/
use ModelQuery;
}
use Rasyidly/ModelQuery/Loadable/Loadable;
use Rasyidly/ModelQuery/Searchable/Searchable;
class User extends Model
{
use Loadable, Searchable;
}
class Post extends Model
{
use ModelQuery;
public $loadable = [
'author.profile', 'commentable'
];
public function author (): BelongsTo { ... }
}
class Post extends Model
{
use ModelQuery;
public $searchable = [
'title', 'description', 'author.name'
];
public function author (): BelongsTo { ... }
}