laravel-idea / plugin

Laravel Idea plugin for PhpStorm
https://laravel-idea.com/
177 stars 7 forks source link

[Feature Request]: Dynamic View Click Through #1083

Open browner12 opened 1 month ago

browner12 commented 1 month ago

Feature Description

Sometimes I'll have a component that supports different "skins", which just means that we conditionally load a view. By passing a variable to the view($pathToFile) method we lose the ability to click through to the view.

It would be amazing if the plugin could analyze the variable, and provide a drop down of any static options (like it does for other features) to allow us to select. I realize it would be impossible to handle any non-static values, and those could be ignored.

$viewPath = match ($skin) {
    'baja-blast' => 'customs.baja-blast',
    'code-red'   => 'customs.code-red',
    'non-static' => 'customs.wont-work-' . rand(1, 10),  //this one would not work
    default      => 'default.path',
};

return view($viewPath);
adelf commented 1 month ago

I can try to make this working.

return view(match ($skin) {
    'baja-blast' => 'customs.baja-blast',
    'code-red'   => 'customs.code-red',
    'non-static' => 'customs.wont-work-' . rand(1, 10),  //this one would not work
    default      => 'default.path',
});