add projet
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* BaseModel replaces the CodeIgniter Model and wires up the legacy builder
|
||||
* and database utility that the existing models expect.
|
||||
*/
|
||||
class BaseModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public CiDatabase $db;
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->db = CiDatabase::instance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure our legacy builder is used so the old helper methods remain available.
|
||||
*/
|
||||
public function newEloquentBuilder($query)
|
||||
{
|
||||
return new CiModelBuilder($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep the familiar CodeIgniter helper available on the model itself.
|
||||
*/
|
||||
public function findAll($limit = 0, $offset = 0)
|
||||
{
|
||||
return $this->newModelQuery()->findAll($limit, $offset);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user