我正在按照教程学习 laravel。我被这个错误困住了
ErrorException in Macroable.php line 81:
Method open does not exist. (View: path\to\project\resources\views\form.blade.php)
我正在使用 FormFacade。早些时候我面临一个错误说:
Call to undefined method Illuminate\Foundation\Application::bindShared()
bindShared
我通过替换singleton
整个文件来克服
/path/project/vendor/illuminate/html/HtmlServiceProvider.php
form.blade.php
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</head>
<body>
<h1>Create a new form</h1>
<hr/>
{{ Form::open() }}
{{ Form::close() }}
</body>
</html>
HtmlServiceProvider.php
use Illuminate\Support\ServiceProvider;
class HtmlServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->registerHtmlBuilder();
$this->registerFormBuilder();
$this->app->alias('html', 'Illuminate\Html\HtmlBuilder');
$this->app->alias('form', 'Illuminate\Html\FormBuilder');
}
/**
* Register the HTML builder instance.
*
* @return void
*/
protected function registerHtmlBuilder()
{
$this->app->singleton('html', function($app)
{
return new HtmlBuilder($app['url']);
});
}
/**
* Register the form builder instance.
*
* @return void
*/
protected function registerFormBuilder()
{
$this->app->singleton('form', function($app)
{
$form = new FormBuilder($app['html'], $app['url'], $app['session.store']->getToken());
return $form->setSessionStore($app['session.store']);
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array('html', 'form');
}
}
请帮忙。