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

feat: Simulate now on #1531

Merged
merged 1 commit into from
Feb 8, 2025
Merged

feat: Simulate now on #1531

merged 1 commit into from
Feb 8, 2025

Conversation

lee-to
Copy link
Collaborator

@lee-to lee-to commented Feb 8, 2025

You can render system pages that need a resource and a page in the URL on arbitrary routes by simulating their URLs

class HomeController extends Controller
{
    public function __invoke(FormArticlePage $page, ArticleResource $resource)
    {
        return $page->simulateRoute($page, $resource)->loaded();
    }
}

NowOn also improved

HasMany::make('Comments', resource: CommentResource::class)
    ->creatable()
    ->nowOn($resource->getFormPage(), $resource, ['resourceItem' => $item->getKey()])
    ->fillCast($item, new ModelCaster(Article::class)),

@lee-to lee-to merged commit ebb7812 into 3.x Feb 8, 2025
18 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.

1 participant