Hello @funkyfela
Can you tell us what the error is?
I found this line a little bit strange: $result = (new CategoryController)->Category()
You create your CategoryController and call the Category function on it. It isn't impossible but normally you don't create a controller class in another controller.
My guess is that you want to load the Categories in your controller and show them on your form.
If that is what you want to have you can do it like this:
public function create() {
return view('products.create', [
'categories' => Category::all(), //load all the categories from the database
]);
}
Ps. I have updated your formatting a little bit :)
khatriafaz, funkyfela, frankdev-327 liked this reply
Hello @tvbeek Thanks for your reply. I was doing the wrong thing all these while! Thanks so much.
Just started learning laravel.
Thanks so much!
tvbeek, funkyfela liked this reply
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community