Skip to content

Commit 99ef6e6

Browse files
committed
feat: add router::view to return views from routes
1 parent c01dc44 commit 99ef6e6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Router.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,19 @@ public static function redirect(
325325
});
326326
}
327327

328+
/**
329+
* Add a route that renders a view
330+
*
331+
* @param string $pattern The route pattern/path to match
332+
* @param string $view The view to render
333+
*/
334+
public static function view(string $pattern, string $view)
335+
{
336+
static::get($pattern, function () use ($view) {
337+
return response()->view($view);
338+
});
339+
}
340+
328341
/**
329342
* Create a resource route for using controllers.
330343
*

0 commit comments

Comments
 (0)