vendredi 24 août 2018

how to restrict browsing users data from url by laravel

the following URL displays data for the with id=1 http://127.0.0.1:8000/user/1 when i change the number to 2 or 3 and click enter it displays the data of users who has the 2 or 3 id

Now i have some Questions: is this normal? is this normal to brows the users data by changing the id through url? is there any method to limit this to clicking th eview icon beside each user row?

i tried the following code

    public function show($id) {
        $uid = \Auth::user()->id;
        if ($uid != 1 && $id === 1) {
            $user = User::find($id);
            return view('users.show', ['user' => $user]);  
        } else {
            return view('errors.503');  
        }
} // End function.
enter code here



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MPHniP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire