title = $title; // $push->content = $content; // $push->user_id = $userid; // $res=$push->save(); if($userid){ $user = User::find($userid); } if($user&&$user->jpush){ $regId = array($user->jpush); $options = array( 'apns_production' => true, ); try { $pusher = $client->push(); $pusher->setPlatform(['ios', 'android']); // $pusher->addAllAudience(); $pusher->addRegistrationId($regId); $pusher->setNotificationAlert($title); $pusher->options($options); $pusher->send(); \Log::info('jpush send!'); } catch (\JPush\Exceptions\APIConnectionException $e) { // try something here \Log::error($e); } catch (\JPush\Exceptions\APIRequestException $e) { // try something here \Log::error($e); } } } }