framework icon indicating copy to clipboard operation
framework copied to clipboard

[Proposal] add resource() to formbuilder

Open marcvdm opened this issue 12 years ago • 4 comments

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);
}

marcvdm avatar Dec 05 '13 22:12 marcvdm

I like this idea.

dwightwatson avatar Dec 09 '13 02:12 dwightwatson

:+1:

lucasmichot avatar Dec 09 '13 09:12 lucasmichot

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.

kfriend avatar Dec 10 '13 01:12 kfriend

Could use Form::macro for this I believe.

taylorotwell avatar Jan 30 '14 16:01 taylorotwell