I'll try to explain my doubt. Maybe the question does not have any sense:
Im creating a Saas project using Vue + Laravel. Logically, it has to support multiple users. For each of them only the user related data should be showed and not the others that must be completely private. Laravel is used only to be accessed via api (im not using blade templates).
So, lets suppose the typical example of the posts. Certain user, after authenticating is presented all his/her posts:
URL: http://myproject.com/posts
(posts data is obtained accesing http://myproject.com/api/posts)
And then clicks in one of them and the posts is presented with full details:
URL: http://myproject.com/posts/4
(posts data is obtained accesing http://myproject.com/api/posts/4)
Supposing posts with id=5 is someone else's, this user could try to access it this way:
URL: http://myproject.com/posts/5
But in my laravel controller I can check the user is accesing only his/her posts by checking f.e:
if (auth()->user()->id == $post->user_id) {
<return the post data>
}
This way access to someone elses posts is not possible.
But the user is aware which ids have the posts he/she owns, and, consequently, the ids of other users posts. Do you think this is the correct way to implement this?