app/Http/Controllers/Admin/NotificationsController.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()
    {
        $field = isset($_GET['field']) ? trim($_GET['field']) : "";
        $dir = isset($_GET['dir']) ? trim($_GET['dir']) : "asc";
        $notifications = null;
        if ($field!="") {
            $notifications = Notification::orderBy($field, $dir)->get();
        }
        else {
            $notifications = Notification::all();
        }
        $data = [
            'notifications' => $notifications,
            'order'  => [
                'field' => $field,
                'dir' => $dir
            ]
        ];
        return view('admin.notifications.index')->with('data', $data);
    }
public function index ( ) { $ field = isset ( $ _GET [ 'field' ] ) ? trim ( $ _GET [ 'field' ] ) : " " ; $ dir = isset ( $ _GET [ 'dir' ] ) ? trim ( $ _GET [ 'dir' ] ) : " asc " ; $ notifications = null ; if ( $ field != " " ) { $ notifications = Notification :: orderBy ( $ field , $ dir ) -> get ( ) ; } else { $ notifications = Notification :: all ( ) ; } $ data = [ 'notifications' => $ notifications , 'order' => [ 'field' => $ field , 'dir' => $ dir ] ] ; return view ( 'admin.notifications.index' ) -> with ( 'data' , $ data ) ; }
Display a listing of the resource.
Display a listing of the resource .