I have the following routes:
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', 'PagesController@index');
Route::get('item', 'ItemController@index');
Route::get('item/create', 'ItemController@create');
Route::get('item/{id}', 'ItemController@show');
Route::get('welcome', function() {
return view('welcome');
});
Route::group(['middleware' => 'web'], function () {
Route::auth();
Route::get('/home', 'HomeController@index');
});
And this is what my Item controller looks like:
@section('content');
<h1>Add a new item</h1>
<hr />
<content>
<div class="form-group">
{!! Form::open() !!}
{!! Form::label('name', "Name") !!}
{!! Form::text('name', null, ['class' => 'form-control']) !!}
{!! Form::close() !!}
</content>
@stopttp\Requests;
use App\Item;
class ItemController extends Controller
{
public function index()
{
//fetch all items from the database
$items = Item::All();
return $items;
}
public function show($id) {
$item = Item::FindOrFail($id);
}
public function create() {
return view::make('item.create');
}
}
create.blade.phpHere is my view located at /resources/views/item/create.blade.php: @section('content');
Add a new item
{!! Form::open() !!}
{!! Form::label('name', "Name") !!}
{!! Form::text('name', null, ['class' => 'form-control']) !!}
{!! Form::close() !!}
@stop
I am trying to load a item creation method for this laravel based e-commerce I am building. I can't seem to access the item.create view when I visit the route in the specified page, just a blank page when I load the view; I do not see the view's HTML. Any help, please?
Heres a copoy of my log files:
[2016-04-19 17:44:41] local.ERROR: exception 'InvalidArgumentException' with message 'View [articles.create] not found.' in /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:137
Stack trace:
0 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php(79): Illuminate\View\FileViewFinder->findInPaths('articles.create', Array)
1 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/View/Factory.php(165): Illuminate\View\FileViewFinder->find('articles.create')
2 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(783): Illuminate\View\Factory->make('articles.create', Array, Array)
3 /home/thomas/ushop/app/Http/Controllers/ItemController.php(25): view('articles.create')
4 [internal function]: App\Http\Controllers\ItemController->create()
5 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(80): call_user_func_array(Array, Array)
6 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(146): Illuminate\Routing\Controller->callAction('create', Array)
7 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(94): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\ItemController), Object(Illuminate\Routing\Route), 'create')
8 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
9 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
10 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
11 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
12 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(96): Illuminate\Pipeline\Pipeline->then(Object(Closure))
13 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(54): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\ItemController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'create')
14 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/Route.php(174): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\Http\Contro...', 'create')
15 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/Route.php(140): Illuminate\Routing\Route->runController(Object(Illuminate\Http\Request))
16 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/Router.php(724): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
17 [internal function]: Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
18 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
19 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
20 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
21 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/Router.php(726): Illuminate\Pipeline\Pipeline->then(Object(Closure))
22 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/Router.php(699): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
23 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/Router.php(675): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
24 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(246): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
25 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
26 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
27 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
28 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
29 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
30 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
31 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
32 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
33 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
34 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
35 /home/thomas/ushop/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
36 /home/thomas/ushop/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
37 {main}