• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue Issue with Laravel Component Variable

eliamarsura

Basic Pleskian
Server operating system version
Debian 11.9
Plesk version and microupdate number
18.0.59.2
Hello :)

I'm using Plesk, and I've deployed a new Laravel application.

From the Laravel toolkit, I run the command
Code:
php artisan make:component sidebarnominativi
.

So far, so good. It creates the controller in
Code:
app/View/Components/sidebarnominativi.php
and the blade file in
Code:
resources/views/components/sidebarnominativi.blade.php
.

I open the controller and create a simple function that passes the variable `$nominativi`:

PHP:
public function render(): View|Closure|string

{

    $nominativi = "prova";

    return view('components.sidebarnominativi', compact('nominativi'));

}

I call it in the blade:

HTML:
<div>
    {{ $nominativi }}
</div>

I insert my component in `resources/views/welcome.blade.php` like this:

HTML:
<x-sidebarnominativi />

The result is that when I visit the project's homepage, I receive the error:

Code:
Undefined variable $nominativi (View: serverpath/resources/views/components/sidebarnominativi.blade.php)

Below are all the environment details:
- PHP Version: 8.3.4
- Laravel Version: 10.48.4
- Laravel Config Cached: false
- App Debug: true
- App Env: local

I've already tried the following commands:
- `php artisan view:cache`
- `php artisan view:clear`
- `composer update`
- `composer install`
- `composer dump`

None of these commands generate any errors, and they are not resolving the issue.

I've also tried changing the framework version to `v10.39.0`.

Has anyone ever encountered this issue before?
 
Back
Top