iam-omer-mahdi / ss-v10

0 stars 0 forks source link

Model binding usage #1

Open ModestasV opened 1 year ago

ModestasV commented 1 year ago

Looking at the files I've noticed that model binding is not used:

https://github.com/iam-omer-mahdi/ss-v10/blob/main/app/Http/Controllers/StudentController.php#L38

https://github.com/iam-omer-mahdi/ss-v10/blob/main/app/Http/Controllers/StudentController.php#L166

https://github.com/iam-omer-mahdi/ss-v10/blob/main/app/Http/Controllers/StudentController.php#L177

https://github.com/iam-omer-mahdi/ss-v10/blob/main/app/Http/Controllers/StudentController.php#L189

https://github.com/iam-omer-mahdi/ss-v10/blob/main/app/Http/Controllers/StudentController.php#L288

https://github.com/iam-omer-mahdi/ss-v10/blob/main/app/Http/Controllers/StudentPartController.php#L67

https://github.com/iam-omer-mahdi/ss-v10/blob/main/app/Http/Controllers/StudentPartController.php#L74

https://github.com/iam-omer-mahdi/ss-v10/blob/main/app/Http/Controllers/StudentPartController.php#L106

https://github.com/iam-omer-mahdi/ss-v10/blob/main/app/Http/Controllers/StudentPartController.php#L116

https://github.com/iam-omer-mahdi/ss-v10/blob/main/app/Http/Controllers/StudentPartController.php#L147


All of the files above contain $id where they should/could contain model binding:

https://laravel.com/docs/10.x/routing#route-model-binding

This is not a critical problem but requires you to manually get resources from database in each function