jeudi 23 février 2017

How Can I pass $role->name into function?

I'm using the Laravel Datatables plugin and I would like to pass the ROLE variable into the function so I can access it.

$roles = \Spatie\Permission\Models\Role::all();

    if (!empty($roles)) :

        foreach ($roles as $role) :

            $dt->addColumn($role->name, function ($user) {
                return $this->generate_user_role_button($user, $role->name);
            });

            $rawColumns[] = $role->name;

        endforeach;

    endif;

The code above does not work but I'm wondering what would be the solution.



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

Aucun commentaire:

Enregistrer un commentaire