20
app/Http/Controllers/TitleNewsController.php
Executable file
20
app/Http/Controllers/TitleNewsController.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Title;
|
||||
use Common\Core\BaseController;
|
||||
|
||||
class TitleNewsController extends BaseController
|
||||
{
|
||||
public function __invoke(Title $title)
|
||||
{
|
||||
$this->authorize('show', $title);
|
||||
|
||||
$articles = $title->load([
|
||||
'newsArticles' => fn($q) => $q->limit(4),
|
||||
])->newsArticles;
|
||||
|
||||
return $this->success(['news_articles' => $articles]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user