mardi 12 janvier 2016

Laravel how to run eloquent queries that are value of an array and passed to the view?

Because of a case, I need to store multiple tables eloquent queries to an array and pass the to view, then inside view is should process them. So how can I do that, I have tried with call_user_func() and call_user_func_array() bot not solved the problem and can't run. bellow is my array of eloquent.

$my_eloquent_array = array('course' => 'App\Models\Course::all();',
            'user' => 'App\Models\User::whereHas(
                    \'roles\', function($q){
                    $q->where(\'name\',\'course_coordinator\');
                }
                )->get(array(\'id\',DB::raw(\'CONCAT(first_name, " ", last_name) AS full_name\')))'
);

So now inside view within a loop how i can run those eloquent array values?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire