I'm fairly certain it can't be done because PHPStorm doesn't know anything about the variables that are passed to your template, so it has nowhere to get the information about what might be in those variables from which to provide autocomplete suggestions.
Nov 3, 2016
10
Level 1
Blade autocompletion (with PHPStorm)
For some reasons, it seems that PHPStorm can't autocomplete $var when I'm in a blade template.
For example, I have a VehicleController that pass a Vehicle object to my view :
public function view(Vehicle $vehicle)
{
return view('vehicle.view', compact('vehicle'));
}
In my blade template (/vehicles/view.blade.php) I have something like this :
<h1>{{ $vehicle->name }}</h1>
Nothing special here, it's working. The thing is, when I'm typing in my blade template "$vehicle..." then CTRL+ENTER, PHPStorm display a sad "No suggestions".
I'm new to PHPStorm and Laravel, so maybe :
- PHPStorm doesn't work that way / I am to lazy,
- There something to enable in PHPStorm for this to work,
- I'm missing something in my VehicleController or in my VehicleClass, so PHPStorm can't do the job properly.
Thanks for your reply.
Aurélien
Please or to participate in this conversation.