Start by passing a static value. If that does not work, show the component
Route::get('/', function () {
return inertia('Welcome', [
'setting' => 'please work',
]);
});
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a Welcome.jsx page that I want to display company_name from the Setting model. But when I pass the variable and I console.log(setting), it returns a null.
const {setting} = usePage().props
console.log(setting);
This is in my web.php:
Route::get('/', function () {
return inertia('Welcome', [
'setting' => Setting::get()->first(),
]);
});
I can't get why the data is not being displayed.
Also this can be simplified
Setting::query()->first()
Please or to participate in this conversation.