framework
framework copied to clipboard
[Proposal] add resource() to formbuilder
Right now when you give a model you need to set the method when calling Form::model
When using the resource controller the update needs to be a put. so why not set it at default when using the below method
Form::resource($model);
public function resource($model, array $options = array())
{
if($model->exists and !isset($options['method']))
{
$options['method'] = 'put';
}
return $this->model($model,$options);
}
I like this idea.
:+1:
You might need to add in support for arrays for models as well, since Form::model() also supports plain arrays. I've never used arrays with it, but getModelValueAttribute() would suggest they are supported.
Could use Form::macro for this I believe.