| Current Path : /var/www/html/dynaweb-starter/app/Repositories/ |
| Current File : /var/www/html/dynaweb-starter/app/Repositories/BaseRepository.php |
<?php
namespace App\Repositories;
use App\Contracts\BaseRepositories;
class BaseRepository implements BaseRepositories
{
public $model;
public function __construct($model)
{
$this->model = $model;
}
/***
* Get All
*/
public function getAll()
{
return $this->model::all();
}
/***
* Get By Id
*/
public function getById($id)
{
return $this->model::find($id);
}
/***
* Delete
*/
public function delete($id)
{
return $this->model::delete($id);
}
/***
* Create
*/
public function create($payload)
{
return $this->model::create($payload);
}
/***
* Update
*/
public function update($id, $payload)
{
return $this->model::findOrFail($id)->update($payload);
}
}