Skip to content

Commit

Permalink
[4.x] Implied Statamic route views (#9436)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga authored Jan 31, 2024
1 parent 35200d1 commit bffeedd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Mixins/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
namespace Statamic\Mixins;

use Statamic\Http\Controllers\FrontendController;
use Statamic\Support\Str;

class Router
{
public function statamic()
{
return function ($uri, $view, $data = []) {
return function ($uri, $view = null, $data = []) {
if (! $view) {
$view = Str::of($uri)->ltrim('/');
}

return $this->get($uri, [FrontendController::class, 'route'])
->defaults('view', $view)
->defaults('data', $data);
Expand Down

0 comments on commit bffeedd

Please sign in to comment.