الصفحات · Laravilt
Utilities
Get and Set state helpers, RTL detection, colors and frontend stack detection.
Get
Laravilt\Support\Utilities\Get reads nested values with dot notation:
It is injected into component closures:
Set
Laravilt\Support\Utilities\Set writes nested values by reference and tracks changes:
In closures:
Translator
Laravilt\Support\Utilities\Translator detects right-to-left locales:
Color
Laravilt\Support\Colors\Color holds the default hex colors as constants (Color::Primary, Color::Secondary, Color::Success, Color::Danger, Color::Warning, Color::Info, plus a palette). Color::all() and Color::semantic() return them as arrays.
Frontend
Laravilt\Support\Frontend tells packages and your code which frontend stack the app uses:
| Method | Returns |
|---|---|
Frontend::stack() | 'vue' or 'react': the laravilt-support.frontend config value, otherwise detect() |
Frontend::detect(?string $packageJsonPath = null) | 'react' if package.json has React but not Vue, otherwise 'vue' |
Frontend::isReact() / Frontend::isVue() | bool |
Frontend::isValid(string $stack) | bool |
Frontend::resourceDirectory(?string $stack = null) | 'react' for React, 'js' for Vue (the folder under a package's resources/) |
Set the stack explicitly in .env (the installer writes this for you):
This is the frontend key in config/laravilt-support.php.
React support requires Laravilt v1.1 or later.