Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel View not Found

I am returning a view in a laravel app Here is the route

Route::get('roles', 'CreateList@create');

and then in the controller

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class CreateList extends Controller
{
    function create(){

        $roles = DB::table('sec_role')->get();
        return view('roles.blade.php', compact('role_id', 'name'));

    }
}

Finally I do have a roles.blade.php in my Resources/views folder but when I go to the route I get the

InvalidArgumentException in FileViewFinder.php line 137:
View [roles.blade.php] not found. 

error

I've alredy tried clear and config the cache

like image 688
Mntfr Avatar asked Feb 16 '26 15:02

Mntfr


1 Answers

You shouldn't use full file name:

 return view('roles', compact('role_id', 'name'));

https://laravel.com/docs/5.3/responses#view-responses

like image 178
Alexey Mezenin Avatar answered Feb 19 '26 05:02

Alexey Mezenin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!