Skip to content
Advertisement

How to get All data from a model except one?

I want to retrieve all users data except one.for that i used the following query

JavaScript

When i dd() the output I see all the users data except the one But when I send the query results in foreach() loop in view page I see

Trying to get property of non-object

Error in view page.What’s the Error here? Can anyone suggest me please?

Here is the foreach loop i used in view page

JavaScript

Advertisement

Answer

pluck() creates an array with [id => name] structure, so change the code in assign_rol‌​e.blade.php to:

JavaScript

And pluck() parameters to:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement