Request::isJson PHP Method

isJson() public static method

Determine if the request is sending JSON.
public static isJson ( ) : boolean
return boolean
        public static function isJson()
        {
            return \Illuminate\Http\Request::isJson();
        }

Usage Example

 public function verify()
 {
     if (!Request::ajax() || !Request::isJson()) {
         return Response::make('...', 403);
     }
     $arr = Input::all();
     $session_token = Session::get('_token');
     //$session_token = Session::get('real');
     $_token = $arr['_token'];
     //                if( !isset($arr['time']) || $arr['time'] == null)
     //                {
     //                    $arr['time'] = 0;
     //                }
     if ($session_token == $_token) {
         $data = array('telphone' => trim($arr['phone']), 'score' => $arr['score'], 'time' => $arr['time']);
         $type = $arr['type'];
         if ($data['time'] < 0) {
             $data['time'] = 0;
         }
         $telphone = trim($arr['phone']);
         $partten = "/1\\d{10}/";
         if (preg_match($partten, $telphone)) {
         } else {
             return Response::make('f**k', 403);
         }
         if ($this->save($data, $type)) {
             $position = $this->getPosition($type, $telphone);
             return Response::json($position);
         } else {
             return Response::make('f**k!', 403);
         }
     } else {
         return Response::make('403!', 403);
     }
 }
All Usage Examples Of Request::isJson