Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route Model Binding #155

Open
AjithLalps opened this issue Mar 11, 2020 · 0 comments
Open

Route Model Binding #155

AjithLalps opened this issue Mar 11, 2020 · 0 comments

Comments

@AjithLalps
Copy link

Is your feature request related to a problem? Please describe.
The generated controller file has find() function to find any object. like below:

 public function update($id, TourCategoriesFormRequest $request)
    {
        try {
          ....
          $tourCategory = TourCategory::findOrFail($id);
          ....
        } catch (Exception $exception) {
         ...
        }
    }

Describe the solution you'd like
We can use laravel's Route Model Binding.
Ref:https://laravel.com/docs/7.x/routing#route-model-binding
for cleaner and faster code

@AjithLalps AjithLalps changed the title Model Binding Route Model Binding Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant