Update source into github

This commit is contained in:
pbao9
2025-07-24 16:18:27 +07:00
parent 41419358dd
commit 69851ac7bc
2642 changed files with 284095 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
<?php
namespace App\Repositories;
abstract class BaseRepository implements BaseRepositoryInterface
{
public $model;
public function __construct()
{
$this->setModel();
}
abstract public function getModel();
protected function setModel()
{
$this->model = app()->make($this->getModel());
return $this;
}
public function create(array $data = [])
{
return $this->model->create($data);
}
public function getAll()
{
return $this->model->all();
}
public function find($id)
{
return $this->model->find($id);
}
public function insert(array $data = [])
{
return $this->model->insert($data);
}
public function update(int $id = 0, array $data = [])
{
$result = $this->find($id);
if ($result) {
$result->update($data);
return $result;
}
return false;
}
public function delete($id)
{
$result = $this->find($id);
if ($result) {
$result->delete();
return true;
}
return false;
}
public function getCount()
{
return $this->model->count('id');
}
}