Mntfr Mntfr - 1 month ago 20
PHP Question

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

Answer

You shouldn't use full file name:

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

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