mardi 1 novembre 2016

Preload a view in laravel with different data

I am usign laravel and sentinel to develop a permission system however it was designed so that the user can select and deselect wich permissions the role has from a checkbox form. I have alredy coded the part where they can assign permissions however I need that the checkboxes that have already been asigned are marked when the user request the page. How do you recommend aproaching this? I am using a middleware

<?php

namespace App\Http\Middleware;

use Closure;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;

class PermissionsMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */

    public function handle($request, Closure $next)
    {
        $user = Sentinel::findById(1);
        $permisos = array(array_keys($user['permissions']))

        return $next($request);
    }
}

however I dont know how to pass data from the middleware to the view.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire