43 lines
692 B
PHP
43 lines
692 B
PHP
|
<?php
|
||
|
|
||
|
|
||
|
namespace App\Repositories;
|
||
|
|
||
|
|
||
|
use App\Models\User;
|
||
|
|
||
|
class UsersRepository implements UsersRepositoryInterface
|
||
|
{
|
||
|
public function getAll()
|
||
|
{
|
||
|
return User::all();
|
||
|
}
|
||
|
|
||
|
public function paginate($chunkSize)
|
||
|
{
|
||
|
return User::paginate($chunkSize);
|
||
|
}
|
||
|
|
||
|
public function create($data)
|
||
|
{
|
||
|
return User::create($data);
|
||
|
}
|
||
|
|
||
|
public function delete($id)
|
||
|
{
|
||
|
$user = User::find($id);
|
||
|
return $user->delete();
|
||
|
}
|
||
|
|
||
|
public function getById($id)
|
||
|
{
|
||
|
$user = User::find($id);
|
||
|
return $user;
|
||
|
}
|
||
|
|
||
|
public function getWhereEquals($field, $actual)
|
||
|
{
|
||
|
return User::where($field, $actual);
|
||
|
}
|
||
|
}
|