Rebuilding with CodeIgniter 4
This commit is contained in:
parent
e6dcc92267
commit
3bce4ad0ac
92 changed files with 7304 additions and 380 deletions
21
app/Models/BlogModel.php
Normal file
21
app/Models/BlogModel.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class BlogModel extends Model
|
||||
{
|
||||
protected $table = 'blog';
|
||||
|
||||
public function getBlog($slug = false)
|
||||
{
|
||||
if ($slug === false)
|
||||
{
|
||||
return $this->findAll();
|
||||
}
|
||||
|
||||
return $this->asArray()
|
||||
->where(['slug' => $slug])
|
||||
->first();
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue