12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace App\Repositories;
- use App\Models\StarNews;
- use Dingo\Api\Http\Response;
- use Symfony\Component\HttpKernel\Exception\HttpException;
- /**
- * Created by PhpStorm.
- * User: durong
- * Date: 2019/6/17
- * Time: 下午18:59
- */
- class StarNewsRepository
- {
- public function __construct(StarNews $starNews)
- {
- $this->starNews = $starNews;
- }
- public function index($request)
- {
- if (isset($request['id'])){
- return $this->starNews
- ->where('id',$request['id'])->orderBy('id', 'desc')->first();
- }
- $this->starNews = $this->starNews
- ->orderBy('id', 'desc')->get();
- return $this->starNews;
- }
- }
|