Skip to content

Commit

Permalink
feat: add router::view to return views from routes
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Jan 28, 2025
1 parent c01dc44 commit 99ef6e6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,19 @@ public static function redirect(
});
}

/**
* Add a route that renders a view
*
* @param string $pattern The route pattern/path to match
* @param string $view The view to render
*/
public static function view(string $pattern, string $view)
{
static::get($pattern, function () use ($view) {
return response()->view($view);
});
}

/**
* Create a resource route for using controllers.
*
Expand Down

0 comments on commit 99ef6e6

Please sign in to comment.