Skip to content
Snippets Groups Projects

Add news

Merged Steve Aguet requested to merge addNews into master
11 files
+ 2839
1365
Compare changes
  • Side-by-side
  • Inline
Files
11
<?php
namespace App\Http\Controllers\Api\V1;
use App\Http\Controllers\Api\ApiController;
use App\Http\Resources\News as JsonResource;
use App\Models\News;
use Illuminate\Http\JsonResponse;
class NewsController extends ApiController
{
public function last(): JsonResponse
{
$resource = News::published()->latest()->first();
return $this->renderJson(new JsonResource($resource));
}
}
Loading