update code
This commit is contained in:
61
app/Repositories/Eloquents/UserRepositoryEloquent.php
Normal file
61
app/Repositories/Eloquents/UserRepositoryEloquent.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Eloquents;
|
||||
|
||||
use Prettus\Repository\Eloquent\BaseRepository;
|
||||
use Prettus\Repository\Criteria\RequestCriteria;
|
||||
use App\Contracts\Repositories\UserRepository;
|
||||
use App\Entities\User;
|
||||
|
||||
/**
|
||||
* Class UserRepositoryEloquent.
|
||||
*
|
||||
* @package namespace App\Repositories\Eloquents;
|
||||
*/
|
||||
class UserRepositoryEloquent extends BaseRepository implements UserRepository
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fieldSearchable = [
|
||||
'id' => '=',
|
||||
'name' => 'like',
|
||||
'email' => '=',
|
||||
'tel' => '=',
|
||||
'birthday' => '=',
|
||||
'department_id' => '=',
|
||||
'title_id' => '=',
|
||||
'active' => '=',
|
||||
'created_at' => 'like',
|
||||
'updated_at' => 'like',
|
||||
|
||||
'roles.id' => '=',
|
||||
'roles.name' => 'like',
|
||||
|
||||
'department.id' => '=',
|
||||
'department.name' => 'like',
|
||||
'department.tel' => '=',
|
||||
|
||||
'title.id' => '=',
|
||||
'title.name' => 'like',
|
||||
];
|
||||
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function model()
|
||||
{
|
||||
return User::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Boot up the repository, pushing criteria
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->pushCriteria(app(RequestCriteria::class));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user