• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

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