lundi 19 juin 2017

How to solve the error Route is not bound in laravel 5.1?

enter image description here

when runnig my view it shows the Route is not bound error.

following is my controller code public function assignRoles() {

    $title = trans('admin/privilegeduser.assign_roles');

    $routes = collect(Route::getRoutes()->getRoutes());

    $admin_routes = $routes->filter( function ($route) {

        if (array_has($route->getAction(), 'controller')) {

            $controller_action = array_get($route->getAction(), 

'controller');

            $is_admin_route = preg_match('/App\\\\Http\\\\Controllers\\\\Admin\\\\.*/', 
                $controller_action);

            return (is_numeric($is_admin_route) && ($is_admin_route > 0));

        }

        return false;

    }); 

    // dd($admin_routes);

    return view('app.admin.privilegeduser.assign_roles',compact('title','admin_routes'));

}

following is the view code

@extends('app.admin.layouts.default')

@section('title') } :: @parent @stop

@section('styles')

@endsection

@section('main')

                <div class="panel panel-success" data-sortable-id="ui-widget-11">
                    <div class="panel-heading">
                        <div class="panel-heading-btn">
                            <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                            <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-repeat"></i></a>
                            <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
                            <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger" data-click="panel-remove"><i class="fa fa-times"></i></a>
                        </div>
                        <h4 class="panel-title">  </h4> 
                    </div>
                    <div class="panel-body"> 
                      @include('utils.errors.list')
                      @include('flash::message')

                    <form action="" method="post">
                        <input type="hidden" name="_token" value="">
                            <div class="form-group">
                                <label class="control-label col-md-4 col-sm-4"> </label>
                                    <div class="col-md-6 col-sm-6">
                                        <a href="{!! url('admin/assign_role') !!}"><div id="new" class="btn btn-primary"></div></a>
                                    </div>
                                </div>
                                <div class="routes">
                                    @foreach ($admin_routes as $value)

                                    <input type="checkbox" name="admin_routes">

                                    @endforeach
                                </div>
                                <div class="btn col-sm-offset-4">
                                    <button type="submit" class="btn btn-primary"></button>
                            </div>
                        </form>
                    </div>
                </div>

@endsection

@section('scripts') @parent

<script>
    $(document).ready(function() {
        App.init();           
    });



</script>
@endsection



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire