imanghafoori1/laravel-widgetize

Widget View File not found

spawn81 opened this issue · 15 comments

Hi,
I have the following error:
"View file "Widgets::webSPV.Widgets.CategoriaAllieviWidgetView" not found by 'webSPV\Widgets\CategoriaAllieviWidget '

I'm using laravel 5.8 and I followed the install instruction.
They I typed: php artisan make:widget CategoriaAllieviWidget
and I have in my app/Widgets folder CategoriaAllieviWidget.php and CategoriaAllieviWidgetView.blade.php

I called @widget('CategoriaAllieviWidget', ['a' => 'someVal', 'b' => 'foo']) in a view and that's where the error rises.
do you have any clues?
thanks and good job for the great package

Are all the other widgets ok in your project except this one ?!
Or you have this kind of error for any widget you create ?

I can not reproduce it.

Hi, thank you for your reply.
It happens for all the widgets, but luckly I've just solved the issue moving the generated views in the view folder and explicitly binding them using $template, eg. public $template = 'widgets.AlunniChartWidgetView';
(I had also use $contextAs to get rid of the laravel section start error)

It is kinda strange.
Please note the exact version of widgetize package and OS you are using.

composer show
will help you see the installed versions

widgetize: v1.9.2
windows: 10 home 64bit v1803

what if you completely remove public $template = 'widgets.AlunniChartWidgetView'; from your widget ?

and not setting it public $template = ''; if you have had done it.

Well I followed the instructions (without setting the $template, $contextAs) and
I have the laravel error: can't find the view
The same error rises with $template not set and $template=''

and you are using laravel 5.8 right ?

i have to investigate the possible root cause of that.

yes, laravel 5.8.16.
I think "an easy fix" could be:
once u run the make:widget , in your generated files u should create a folder in views (eg a widget folder) in which you save the view as u do, and in the widgetname.php u write the $template= "widgets/widgetview"

let me know as soon as u find a solution and thanx again for this useful package

but I ran the exact same command on my windows 10 machine and laravel 5.8.
and everything was ok.

I do not know how it is not working for you !

I really don't know, i'm sry i can't help., but at least there is a fix.

@spawn81 Ahaaa I now get it

You may have renamed the app folder to webSPV.

So you do not have any app folder. right ?

Could you please try the latest v1.9.5 ?
and report me if you have any issues.

if you have done something like this in your composer file :

       "psr-4": {
           "webSPV\\": "app/"
       },

you are right, and this was a bug.
which is fixed.

thanks for reporting .

Hi, sry for late reply.
I can confirm, with the last update everything works like a charme
Thank you again.