Expose the signed-in user and other request context to a view Engine
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
Research direction
Start by reading Template and the Engine extension point, then inspect how request context is made available to views. The issue identifies signed-in user access as a concrete gap; the broader request, authorization, config, translation, and clock APIs need a design decision. Done means agreeing on the supported context API and exposing the selected data to engines.
Written by the indexing model from the issue text.
Description
I built an external Blade engine on top of laravel::view::Engine (https://github.com/RicardoAugustoTulio/laravel-rust-blade) to ease migrating Laravel PHP apps. The extension point worked without framework changes, including a multi-dot extension (engine("blade.php", ..)) next to MiniJinja .html views. A few things an Engine can't reach, so the crate works around them:
- Named routes. Already reported in #784. I'd use the same
route_namedlookup. - The signed-in user.
@authand@guesthave to read the session value under the literal key"_auth.web.id".USER_ID_KEY(crates/http/src/session/mod.rs) isn't re-exported bylaravel, so the engine depends on that spelling. Eitherpub usethe constant fromlaravel::session, or addTemplate::user_id() -> Option<...>. - Request, authorization, config, translations, clock. Nothing on
Templategives an engine the request (request()->is(..)),@canchecks, config values or translated strings. The crate fails these at compile time with a message, and lets the application register its own function. If a small read-only handle (for example the request's path and query, or a way to run a policy check) is welcome onTemplate, I can propose the shape in a PR. If not, the current workaround is fine.
The engine's other framework notes are in https://github.com/RicardoAugustoTulio/laravel-rust-blade/blob/master/docs/FRAMEWORK.md.
Seen on 0.x. Happy to send a PR for 2 if the approach is welcome.
- Dominant language
- Rust
- Stars
- 847
- Forks
- 174
- Avg merge
- 5h 40m
- Merged PRs (30d)
- 167
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from laravel/rust-framework
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
laravel/rust-framework#864 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
laravel/rust-framework#876 ·
Maintainers usually reply within 1 day
-
Case-sensitive contains, starts_with and ends_with that match % and _ literally on every databaseOpen
Difficulty 4/5 3-5 days Newbie friendliness 58/100
laravel/rust-framework#874 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
laravel/rust-framework#873 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
laravel/rust-framework#872 ·
Maintainers usually reply within 1 day
All issues in laravel/rust-framework
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
neuralmagic/crucible#579 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
eclipse-score/kyron#249 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
seanmonstar/reqwest#3157 ·
Maintainers usually reply within 2 days