0

I see this question a lot, and I tried many of the solutions but none seems to help. I hope that with my code shown I'll be able to work it out!

This is my route:

Route::view('/', 'pages.home');
Route::view('about', 'pages.about');
//Route::view('shop', 'shop.shop');
Route::get('shop', 'App\Http\Controllers\Shop\ShopController@displayShop');

and this is my controller:

<?php

namespace App\Http\Controllers\Shop;

use Illuminate\Http\Request;
use App\Models\Category;

class ShopController extends Controller
{
    public function displayShop() {
        $data['categories'] = Category::getCategories();
        return view('shop,shop', $data);
    }
}

And here is where my file is located [1]: https://i.stack.imgur.com/rM4as.png

thank you for your help!

Shira
  • 61
  • 1
  • 2
  • 9

1 Answers1

1

If your are using Laravel 8, the new way to call controllers from route is

Route::get('shop', [ShopController::class, 'displayShop']);
mmabdelgawad
  • 2,385
  • 2
  • 7
  • 15