Added News page
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Loaders;
|
||||
|
||||
use App\Models\ORM\News;
|
||||
|
||||
class NewsLoader
|
||||
{
|
||||
public function getNews(int $offset = 0, int $limit = 10): array
|
||||
{
|
||||
$data = News::select("*")
|
||||
->limit($limit)
|
||||
->offset($offset)
|
||||
->get();
|
||||
|
||||
return $data ? $data->toArray() : [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ORM;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class News extends Model
|
||||
{
|
||||
protected $table = 'allNewsView';
|
||||
protected $primaryKey = 'id';
|
||||
}
|
||||
Reference in New Issue
Block a user