app/Http/Controllers/PermissionController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(Request $request, Permission $permissions)
    {
        $total_permissions = Permission::count();
        $search = $request->get('search');
        if ($search != "") {
            $permissions = Permission::where('name', 'LIKE', '%' . $search . '%')->latest()->paginate(10)->setPath('');
            if (isset($permissions)) {
                $pagination = $permissions->appends(array(
                    'search' => $request->get('search')
                ));
                if (count($permissions) > 0) {
                    return view('users.permissions.index', 
                    [
                        'total_permissions' => $total_permissions,
                        'permissions' => $permissions
                    ])
                    ->withStatus($permissions)->withQuery($search);
                }
                $records = 'No';
                return view('users.permissions.index', 
                [
                    'records' => $records, 
                    'total_permissions' => $total_permissions,
                    'permissions' => $permissions
                ])
                ->withStatus($permissions)->withQuery($search);
            }
        }
        return view('users.permissions.index', 
        [
            'total_permissions' => $total_permissions,
            'permissions' => $permissions->latest()->paginate(10)
        ]);
    }
public function index ( Request $ request , Permission $ permissions ) { $ total_permissions = Permission :: count ( ) ; $ search = $ request -> get ( 'search' ) ; if ( $ search != " " ) { $ permissions = Permission :: where ( 'name' , 'LIKE' , '%' . $ search . '%' ) -> latest ( ) -> paginate ( 10 ) -> setPath ( '' ) ; if ( isset ( $ permissions ) ) { $ pagination = $ permissions -> appends ( array ( 'search' => $ request -> get ( 'search' ) ) ) ; if ( count ( $ permissions ) > 0 ) { return view ( 'users.permissions.index' , [ 'total_permissions' => $ total_permissions , 'permissions' => $ permissions ] ) -> withStatus ( $ permissions ) -> withQuery ( $ search ) ; } $ records = 'No' ; return view ( 'users.permissions.index' , [ 'records' => $ records , 'total_permissions' => $ total_permissions , 'permissions' => $ permissions ] ) -> withStatus ( $ permissions ) -> withQuery ( $ search ) ; } } return view ( 'users.permissions.index' , [ 'total_permissions' => $ total_permissions , 'permissions' => $ permissions -> latest ( ) -> paginate ( 10 ) ] ) ; }
Display a listing of the resource.
Display a listing of the resource .