// page not found abort(404);
Generate an HTTP exception response using status code
// page not found abort(404);
Generate an HTTP exception response using status code
public function isValid($value) { try { // Validate the value... } catch (Throwable $e) { report($e); return false; } }
Report an exception but continue handling the current request
$url = route('profile');
See Named Route
Generate arbitrary URLs for your application that will automatically use the scheme (HTTP or HTTPS) and host from the current request
$post = App\Models\Post::find(1); echo url("/posts/{$post->id}"); // http://example.com/posts/1
// Get the current URL without the query string... echo url()->current(); // Get the current URL including the query string... echo url()->full(); // Get the full URL for the previous request... echo url()->previous();
$url = route('profile');
With parameters
// Route::get('/user/{id}/profile', /\*...\*/ )->name('profile); $url = route('profile', ['id' => 1]); // /user/1/profile/
With query string
// Route::get('/user/{id}/profile', /\*...\*/ )->name('profile); $url = route('profile', ['id' => 1, 'photos'=>'yes']); // /user/1/profile?photos=yes
// Generating Redirects... return redirect()->route('profile');
echo route('post.show', ['post' => $post]);
The route helper will automatically extract the model's route key. See Routing