I have the following Laravel functions
public function addNewPhotoRequest($uuid) {
$photos = DB::table('photos')->where('uuid', '=', request('qr_code'))->get();
$new_photo_request = new Photos;
$new_photo_request->uuid = $uuid;
$new_photo_request->save();
$this->submitPhotoRequest($new_photo_request->photo_id);
}
After executing the $this->submitPhotoRequest line, the function will not return the view. I can't return any views nor perform any redirects using the "Return Redirect XXX". It works fine if I put these statements in the addNewPhotoRequest function so I know there is nothing wrong with my views or routes. Any ideas? All that is returned is a blank white page with no errors reported. I can do a DD("test") on the submit photo request function, so I know the function works and is going to it correctly.
/**
* Submit the API code if it matches a valid code within the database.
* This will allow the user to upload a photo and associate it with a database record.
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function submitPhotoRequest($photo_id)
{
return view('upload_photo', ['api_code' => $photo_id]);
}
CodePudding user response:
If addNewPhotoRequest
is the method being declared in the route, then you are missing the return
....
Your code should be like this:
public function addNewPhotoRequest($uuid) {
$photos = DB::table('photos')->where('uuid', '=', request('qr_code'))->get();
$new_photo_request = new Photos;
$new_photo_request->uuid = $uuid;
$new_photo_request->save();
return $this->submitPhotoRequest($new_photo_request->photo_id);
}