Request::format PHP Method

format() public static method

Get the data format expected in the response.
public static format ( string $default = 'html' ) : string
$default string
return string
        public static function format($default = 'html')
        {
            return \Illuminate\Http\Request::format($default);
        }

Usage Example

Example #1
0
 public function respond($results, $view, $view_options, $message = null)
 {
     if (Request::format() == 'html') {
         if (!$results) {
             return View::make('404');
         }
         return View::make($view, $view_options);
     } else {
         if (!$results) {
             return Response::json(null, 404);
         }
         return Response::json(array('data' => $results->toArray(), 'status' => 'success', 'message' => "Success"), 200);
     }
 }
All Usage Examples Of Request::format