Blog and Pages are now database driven, woo!
This commit is contained in:
parent
34fe54c20c
commit
1f1cf3b71b
20 changed files with 137 additions and 24 deletions
|
@ -1,16 +1,19 @@
|
|||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
use CodeIgniter\Services;
|
||||
|
||||
class BlogModel extends Model
|
||||
{
|
||||
protected $table = 'blog';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
public function getBlog($slug = false)
|
||||
{
|
||||
if ($slug === false)
|
||||
{
|
||||
return $this->findAll();
|
||||
return $this->orderBy('id', 'DESC')
|
||||
->findAll();
|
||||
}
|
||||
|
||||
return $this->asArray()
|
||||
|
@ -18,4 +21,10 @@ class BlogModel extends Model
|
|||
->first();
|
||||
}
|
||||
|
||||
public function getBlogs($limit = false, $offset = 0)
|
||||
{
|
||||
return $this->orderBy('id', 'DESC')
|
||||
->findAll($limit, $offset);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue