add and delete news from admin dashboard #52

This commit is contained in:
Nabeel Shahzad
2018-01-08 16:22:26 -06:00
parent 5a12493739
commit 6b265ed67b
10 changed files with 149 additions and 21 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Repositories;
use App\Models\News;
use App\Repositories\Traits\CacheableRepository;
use Prettus\Repository\Contracts\CacheableInterface;
class NewsRepository extends BaseRepository implements CacheableInterface
{
use CacheableRepository;
public function model()
{
return News::class;
}
/**
* Latest news items
* @param int $count
* @return mixed
*/
public function getLatest($count=5)
{
return $this->orderBy('created_at', 'desc')
->with(['user'])
->paginate($count);
}
}