vendredi 1 janvier 2016

Unique collection in Laravel

I need to find of unique value. So I tried bellow code. It is through undefined variable error.

Controller: $employee = Employee::all(); Return view ('page', compact(employee));

Page view: $uniqueEmpLoc = $employee->unique('location')->values()->list('location')->toArray(); @Foreach($uniqueEmpLoc as $empLoc) { {{ $empLoc }} } @endforeach

But I got an uniqueEmpLoc is undefined error. I'm using LARAVEL 5.1. Please help me to solve this problem.



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

Aucun commentaire:

Enregistrer un commentaire