Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New url generator #924

Merged
merged 11 commits into from
May 4, 2024
Merged

New url generator #924

merged 11 commits into from
May 4, 2024

Conversation

lee-to
Copy link
Collaborator

@lee-to lee-to commented May 4, 2024

MoonShineRouter

moonshineRouter()->to('route_name'); // moonshine.route_name


moonshineRouter()
   ->withName('async')
   ->to('component'); // moonshine.async.component


moonshineRouter()->withResource($resource)->withPage($page)->to('route_name');
moonshineRouter()->toPage($page);

An easy way to announce your routes under the moonshine middleware

Route::moonshine(function(Router $router) {
    $router->get('/action', [MyController:class, 'action'])->name('route_name'); // /admin/action
});

Route::moonshine(function(Router $router) {
    $router->get('/action', [MyController:class, 'action'])->name('route_name'); // /admin/resource/{resourceUri}/action
}, resource: true);

Resource

$resource->router()->to('route_name');
$resource->router()->toPage($page);

Page

$page->router()->to('route_name');

@lee-to lee-to changed the base branch from 2.x to 3.0 May 4, 2024 09:29
@lee-to lee-to merged commit d19c917 into moonshine-software:3.0 May 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants