Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Sankame
Created May 6, 2020 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sankame/6cc553841d60ab142909ad7a75b951ee to your computer and use it in GitHub Desktop.
Save Sankame/6cc553841d60ab142909ad7a75b951ee to your computer and use it in GitHub Desktop.
Sample code using Laravel, PHPUnit and Mockery
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$contact = Contact::find($id);
//When you can not find the record, back to the home.
if($contact === null){
return redirect('/contacts');
}
return view('contacts.edit', compact('contact'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment