Before in my controllers file there is no UserController.php then I made it manually and then after that I do this "php artisan make:controller UsersController" then it's already then when I start type the html on my index.blade.php it says error. Can someone help me with this?
This is the UserController.php
<?php
namespace App\Http\Controllers;
use App\Models\cr;
use Illuminate\Http\Request;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
*/
public function index()
{
return view('users.index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(cr $cr)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(cr $cr)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, cr $cr)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(cr $cr)
{
//
}
}
This is my navBar.balde.php
<a href="#" data-bs-toggle="modal" data-bs-target="#staticBackdrop" class="btn btn-outline rounded-pill"><i class="fa-sharp fa-solid fa-list"></i></a>
<a href="{{ route('users.index') }}" class="btn btn-outline rounded-pill"><i class="fa-sharp fa-solid fa-list"></i> Users</a>
<a href="#" class="btn btn-outline rounded-pill"><i class="fa-sharp fa-solid fa-list"></i> Menu</a>
<a href="#" class="btn btn-outline rounded-pill"><i class="fa-sharp fa-solid fa-list"></i> Cashier</a>
<a href="#" class="btn btn-outline rounded-pill"><i class="fa-sharp fa-solid fa-list"></i> Reports</a>
<a href="#" class="btn btn-outline rounded-pill"><i class="fa-sharp fa-solid fa-list"></i> Transactions</a>
<a href="#" class="btn btn-outline rounded-pill"><i class="fa-sharp fa-solid fa-list"></i> Reports</a>
<style>
.btn-outline{
border-color: #F2921D;
color: #F2921D;
}
.btn-outline:hover {
background: #F2921D
color: #F2921D
}
</style>
This is my web.php
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\UserController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::resource('/orders', 'OrderController'); // orders.index
Route::resource('/products', 'ProductController'); // products.index
Route::resource('/users', 'UserController'); // userController
Route::resource('/companies', 'CompanyController'); // companies.index
Route::resource('/transactions', 'TransactionController'); // transactions.index
Auth::routes();
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
Auth::routes();
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
This is my index.blade.php
@extends('layouts.app')
@section('content')
<h4>Hello Users</h4>
@endsection
I already try use the method that told me to add "protected $namespace = 'App\Http\Controllers';" on RouteServiceProvider.php, and I try on web .php "use App\Http\Controllers\UserController;" but both of that still doesn't fix it. Can somebody help me with this cause I stuck on this problem for now.