lundi 30 mai 2016

Laravel 5 Bleeding From Protected $Hidden

In my App/User I have the following:

protected $hidden = ['name', 'password', 'email', 'remember_token','created_at', 'updated_at','api_token','gmail_id','Personal'];

My understanding was that this was used to prevent sensitive information stored in the database as part of the model from leaking out into the view.

But it doesn't seem to be working?

When I query the users table from a many-to-many relationship, and print_r() my variable, I get to see all the data from the given row in the Users table, including the hidden columns.

What am I doing wrong?

In the controller : $achievements = User::where('id', Auth::user()->id)->first()->achievements()->orderBy('Time', 'desc')->take(1)->get();

In the view:



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1UeET5J
via IFTTT

Aucun commentaire:

Enregistrer un commentaire