Alander 2022-09-30 12:24:47
Ok
Alander 2022-09-30 12:25:10
Nothing else?
Anand Tujare 2022-09-30 12:25:10
ie return view(“service.index”, compact(‘service’));
Anand Tujare 2022-09-30 12:25:34
That should do it…
Alander 2022-09-30 12:25:42
Thanks. I will try
Anand Tujare 2022-09-30 12:26:55
I would also suggest instead of using DB::table(‘table_name’)->get(); use the model ModelName::all();
Alander 2022-09-30 12:27:49
How I use that ?
Alander 2022-09-30 12:28:50
The errors continues using compact
Anand Tujare 2022-09-30 12:28:58
Instead of
DB::table(‘table_name’)->get();
use
ModelName::all();
Alander 2022-09-30 12:29:39
Ok
Alander 2022-09-30 12:31:38
The same error
Jonathan Antunes 2022-09-30 12:31:54
Alander 2022-09-30 12:23:54

Jonathan Antunes 2022-09-30 12:32:04
an example
Alander 2022-09-30 12:32:45

Alander 2022-09-30 12:34:39
Is there anything wrong in my code?
Jonathan Antunes 2022-09-30 12:34:53
No
Alander 2022-09-30 12:35:24
Because I receive the same error
Alander 2022-09-30 12:36:18

Anand Tujare 2022-09-30 12:36:38
Shre the url u r running
Alander 2022-09-30 12:36:52
My table name is servicios
hartge 2022-09-30 12:37:17
return view(‘servicios.index’, Servicio::all())
hartge 2022-09-30 12:37:41
Try this
Alander 2022-09-30 12:37:58
Ok
hartge 2022-09-30 12:38:18
And check what get your Servicio model
hartge 2022-09-30 12:39:14
before return try dd(Servicio::all()) or ddd(Servicio::all). Choose which you want
Alander 2022-09-30 12:40:00
You say inside of controller?
hartge 2022-09-30 12:40:26
return view(‘servicios.index’, Servicio::all()) – not working??
Alander 2022-09-30 12:40:55
No
hartge 2022-09-30 12:41:00
hartge 2022-09-30 12:39:14

before return try dd(Servicio::all()) or ddd(Servicio::all). Choose which you want
Its for debug
hartge 2022-09-30 12:42:36
in controller, index method. Before return, try dd(Servicio::all()) or ddd(Servicio::all). Refresh page. All method have to return Collection with all table fields
Alander 2022-09-30 12:43:40
Yes but the same error
hartge 2022-09-30 12:43:57
In blade comment your foreach
Alander 2022-09-30 12:44:23

Alander 2022-09-30 12:45:06

Anand Tujare 2022-09-30 12:45:30
Alander 2022-09-30 12:45:06

Which url have u opened