Reputation: 513
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
Upvotes: 3
Views: 6310
Reputation: 1814
You don't have to use the full file name:
return view('roles', compact('role_id', 'name'));
If the view is inside any folder,You have to use the folder name to access the view. Eg,If folder name is user,
return view('user.roles', compact('role_id', 'name'));
Upvotes: 0
Reputation: 163748
You shouldn't use full file name:
return view('roles', compact('role_id', 'name'));
https://laravel.com/docs/5.3/responses#view-responses
Upvotes: 6