refactor: use route model binding for user controllers

This commit is contained in:
Roardom
2022-12-29 16:13:27 -06:00
parent 5af0731b00
commit 7f1de1718f
23 changed files with 56 additions and 77 deletions
@@ -21,9 +21,8 @@ class TopicController extends Controller
/**
* Show user topics.
*/
public function index(string $username): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
public function index(User $user): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
{
$user = User::where('username', '=', $username)->sole();
$topics = $user->topics()->latest()->paginate(25);
return \view('user.topic.index', [