Support the ongoing development of Laravel.io →
Authentication Security Eloquent
Last updated 2 years ago.
0

Why not scrap the user id in the route and pull it out of the Auth?

Last updated 2 years ago.
0

kpzani said:

Why not scrap the user id in the route and pull it out of the Auth?

Hey kpzani, thanks for your response.

I realise I haven't fully elaborated on this option - If using routes, I would compare the ID of the current logged in user (Sentry::getUser()->id) against the user_id of that particular todo list (todo_lists.user_id). If the id of the logged in user does not match the user_id of the todo list, they would be redirected.

So I think I am pulling the user ID as you suggested, but from Sentry instead of Auth.

I hope that makes sense!

Tom

Last updated 2 years ago.
0

You need global scope for this, not the query scopes. That culttt rather not the way to go.

Here you'll find how to implement that scope: http://laravel.io/forum/07-24-2014-automatically-append-query-to-model#reply-11122

Last updated 2 years ago.
0

jarektkaczyk said:

You need global scope for this, not the query scopes. That culttt rather not the way to go.

Here you'll find how to implement that scope: http://laravel.io/forum/07-24-2014-automatically-append-query-to-model#reply-11122

Great advice, thanks! I'll follow up on global scopes :)

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.