protected function model($options)
    {
        $model = $options['model'];

        if (isset($options['url'])) {
            // If we're explicity passed a URL, we'll use that.
            array_forget($options, ['model', 'update', 'store']);
            $options['method'] = isset($options['method']) ? $options['method'] : 'GET';

            return $this->form->model($model, $options);
        }

        // If we're not provided store/update actions then let the form submit to itself.
        if (!isset($options['store']) && !isset($options['update'])) {
            array_forget($options, 'model');
            return $this->form->model($model, $options);
        }

        if (!is_null($options['model']) && $options['model']->exists) {
            // If the form is passed a model, we'll use the update route to update
            // the model using the PUT method.
            $name = is_array($options['update']) ? array_first($options['update']) : $options['update'];
            $route = Str::contains($name, '@') ? 'action' : 'route';

            $options[$route] = array_merge((array) $options['update'], [$options['model']->getRouteKey()]);
            $options['method'] = 'PUT';
        } else {
            // Otherwise, we're storing a brand new model using the POST method.
            $name = is_array($options['store']) ? array_first($options['store']) : $options['store'];
            $route = Str::contains($name, '@') ? 'action' : 'route';

            $options[$route] = $options['store'];
            $options['method'] = 'POST';
        }

        // Forget the routes provided to the input.
        array_forget($options, ['model', 'update', 'store']);

        return $this->form->model($model, $options);
    }
protected function model($options)
    {
        $model = $options['model'];

        if (isset($options['url'])) {
            // If we're explicity passed a URL, we'll use that.
            array_forget($options, ['model', 'update', 'store']);
            $options['method'] = isset($options['method']) ? $options['method'] : 'GET';

            return $this->form->model($model, $options);
        }

        // If we're not provided store/update actions then let the form submit to itself.
        if (!isset($options['store']) && !isset($options['update'])) {
            array_forget($options, 'model');
            return $this->form->model($model, $options);
        }

        if (!is_null($options['model']) && $options['model']->exists) {
            // If the form is passed a model, we'll use the update route to update
            // the model using the PUT method.
            $name = is_array($options['update']) ? array_first($options['update']) : $options['update'];
            $route = Str::contains($name, '@') ? 'action' : 'route';

            $options[$route] = array_merge((array) $options['update'], [$options['model']->getRouteKey()]);
            $options['method'] = 'PUT';
        } else {
            // Otherwise, we're storing a brand new model using the POST method.
            $name = is_array($options['store']) ? array_first($options['store']) : $options['store'];
            $route = Str::contains($name, '@') ? 'action' : 'route';

            $options[$route] = $options['store'];
            $options['method'] = 'POST';
        }

        // Forget the routes provided to the input.
        array_forget($options, ['model', 'update', 'store']);

        return $this->form->model($model, $options);
    }
protected function model ( $ options ) { $ model = $ options [ 'model' ] ; if ( isset ( $ options [ 'url' ] ) ) { // If we're explicity passed a URL, we'll use that. array_forget ( $ options , [ 'model' , 'update' , 'store' ] ) ; $ options [ 'method' ] = isset ( $ options [ 'method' ] ) ? $ options [ 'method' ] : 'GET' ; return $ this -> form -> model ( $ model , $ options ) ; } // If we're not provided store/update actions then let the form submit to itself. if ( ! isset ( $ options [ 'store' ] ) && ! isset ( $ options [ 'update' ] ) ) { array_forget ( $ options , 'model' ) ; return $ this -> form -> model ( $ model , $ options ) ; } if ( ! is_null ( $ options [ 'model' ] ) && $ options [ 'model' ] -> exists ) { // If the form is passed a model, we'll use the update route to update // the model using the PUT method. $ name = is_array ( $ options [ 'update' ] ) ? array_first ( $ options [ 'update' ] ) : $ options [ 'update' ] ; $ route = Str :: contains ( $ name , '@' ) ? 'action' : 'route' ; $ options [ $ route ] = array_merge ( ( array ) $ options [ 'update' ] , [ $ options [ 'model' ] -> getRouteKey ( ) ] ) ; $ options [ 'method' ] = 'PUT' ; } else { // Otherwise, we're storing a brand new model using the POST method. $ name = is_array ( $ options [ 'store' ] ) ? array_first ( $ options [ 'store' ] ) : $ options [ 'store' ] ; $ route = Str :: contains ( $ name , '@' ) ? 'action' : 'route' ; $ options [ $ route ] = $ options [ 'store' ] ; $ options [ 'method' ] = 'POST' ; } // Forget the routes provided to the input. array_forget ( $ options , [ 'model' , 'update' , 'store' ] ) ; return $ this -> form -> model ( $ model , $ options ) ; }
Open a form configured for model binding.

@param  array  $options
@return string
Open a form configured for model binding .