Laravel Code Review - Implementing Query Scopes, Form Requests, and Route Model Binding

preview_player
Показать описание
In this video I will do a Laravel junior code review of a simple and straightforward blog API.
I will refactor the code to implement better standards, best practices and to improve the overall readability of the code.

The Github link to the refactored code

Click here to subscribe

Reddit

Facebook

Twitter

LinkedIn

Github

#laravel #codereview #webdevelopment
Рекомендации по теме
Комментарии
Автор

thank you, The best laravel channel

i think ovveriding valdiated method in FormRequest class is better than have many set methode in model , and using value('id') instead of first()->id

public function validated($key=null, $value=null)
{

$validated= parent::validated($key, $value);

reutrn array_merge($validated, [

'slug' => Str::slug( $this->title),
'category_id' => Category::where('slug', $this->request('category'))->value('id');

]);

giveaway