File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Http \Controllers \Api ;
4+
5+ use App \Http \Controllers \Controller ;
6+ use App \Models \Article ;
7+
8+ class ArticleController extends Controller
9+ {
10+ public function index ()
11+ {
12+ return Article::paginate ();
13+ }
14+
15+ public function show (Article $ article )
16+ {
17+ return $ article ->append ('stars_count ' );
18+ }
19+ }
Original file line number Diff line number Diff line change 11<?php
22
3+ use App \Http \Controllers \Api \ArticleController ;
34use App \Http \Controllers \Api \AuthorController ;
45use App \Http \Controllers \Api \PluginController ;
56use Illuminate \Support \Facades \Route ;
910
1011Route::get ('authors ' , [AuthorController::class, 'index ' ]);
1112Route::get ('authors/{author:slug} ' , [AuthorController::class, 'show ' ]);
13+
14+ Route::get ('articles ' , [ArticleController::class, 'index ' ]);
15+ Route::get ('articles/{article:slug} ' , [ArticleController::class, 'show ' ]);
You can’t perform that action at this time.
0 commit comments