About Laravel 5 After use Form::open occur some error
error : Call to a member function domain() on a non-object
FatalErrorException in UrlGenerator.php line 440:
Call to a member function domain() on a non-object
in UrlGenerator.php line 440
at HandleExceptions->fatalExceptionFromError(array('type' => '1', 'message' => 'Call to a member function domain() on a non-object', 'file' => '/home/nl/Laravel/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php', 'line' => '440')) in HandleExceptions.php line 116
at HandleExceptions->handleShutdown()
The Follow are solve
1.install command -> composer create-project laravel/laravel
2.composer update
3.composer require illuminate/html
4.composer dump-autoload
5.php artisan clear-compiled
php artisan optimize
6.
Add to the app.php providers array:
'Illuminate\Html\HtmlServiceProvider',
Add to the app.php aliases array:
'Html' => 'Illuminate\Html\HtmlFacade',
'Form' => 'Illuminate\Html\FormFacade',
7.in route
Route::any('/LoginCheck', 'LoginCheckController@index');
8.
注意 namespace路逕
<?php namespace App\Http\Controllers;
use Illuminate\Support\Facades\Redirect;
class LoginCheckController extends Controller {
如果有使用 \Redirect; 記得要 use
9.in view
{!! Form::open(array('action' => 'LoginCheckController@index', 'method' => 'post')) !!}
{!! Form::close() !!}
沒有留言:
張貼留言