2015-12-23 56 views
0

大家好我有problame與我的形式我寫HTML形式,但它的錯誤 ,這是我的路線代碼爲什麼我的表單不能在laravel 5.1中運行?

Route::get('course','[email protected]'); 

,這是我CourseController:

<?php 

namespace App\Http\Controllers; 

use Illuminate\Http\Request; 

use App\Http\Requests; 
use App\Http\Controllers\Controller; 

class CourseController extends Controller 
{ 
    /** 
    * Display a listing of the resource. 
    * 
    * @return \Illuminate\Http\Response 
    */ 
    public function index() 
    { 
     return view('course.create'); 
    } 

,這是我的看法當然/ create.blade.php

<!DOCTYPE html> 
<html> 
<head> 
    <title>Hello World</title> 
    <link rel="stylesheet" type="text/css" href=""> 
</head> 
<body> 
<div class="container"> 
    {!! Form::open(array('route' => 'course.store')) !!} 

     <input type="text"><br> 
     <input type="password"><br> 
    {!! Form::close() !!} 
</div> 
</body> 
</html> 

和錯誤:

Whoops, looks like something went wrong. 
1/1 FatalErrorException in 818f720d4e075893d8198d2b0ff02e25 line 9: Class 'Form' not found 

幫助我,請

+0

類表格不起作用 – He7nG

回答

9

隨着Laravel 5 *的Form & Html已被棄用。檢查出uprade guide(搜索Form & HTML Helpers)。

1.安裝laravelcollective/html

​​

2.添加FormHTML外牆及服務提供商。

編輯config/app.php和這個行添加到'提供商的數組:

'Collective\Html\HtmlServiceProvider', 

接着,將這些行添加到 '變體' 陣列:

'Form' => 'Collective\Html\FormFacade', 
'Html' => 'Collective\Html\HtmlFacade', 
相關問題