public function form(Priority $priority)
    {
        return $this->form->of('work-orders.priorities', function (FormGrid $form) use ($priority) {
            if ($priority->exists) {
                $url = route('maintenance.work-orders.priorities.update', [$priority->getKey()]);
                $method = 'PATCH';
                $form->submit = 'Save';
            } else {
                $url = route('maintenance.work-orders.priorities.store');
                $method = 'POST';
                $form->submit = 'Create';
            }

            $colors = config('maintenance.colors', []);

            $form->attributes(compact('method', 'url'));

            $form->with($priority);

            $form->fieldset(function (Fieldset $fieldset) use ($colors) {
                $fieldset
                    ->control('input:text', 'name')
                    ->attributes([
                        'placeholder' => 'ex. High / Low',
                    ]);

                $fieldset
                    ->control('select', 'color')
                    ->options($colors)
                    ->value(function (Priority $priority) {
                        return $priority->color;
                    })
                    ->attributes([
                        'class' => 'select2-color',
                    ]);
            });
        });
    }
public function form(Priority $priority)
    {
        return $this->form->of('work-orders.priorities', function (FormGrid $form) use ($priority) {
            if ($priority->exists) {
                $url = route('maintenance.work-orders.priorities.update', [$priority->getKey()]);
                $method = 'PATCH';
                $form->submit = 'Save';
            } else {
                $url = route('maintenance.work-orders.priorities.store');
                $method = 'POST';
                $form->submit = 'Create';
            }

            $colors = config('maintenance.colors', []);

            $form->attributes(compact('method', 'url'));

            $form->with($priority);

            $form->fieldset(function (Fieldset $fieldset) use ($colors) {
                $fieldset
                    ->control('input:text', 'name')
                    ->attributes([
                        'placeholder' => 'ex. High / Low',
                    ]);

                $fieldset
                    ->control('select', 'color')
                    ->options($colors)
                    ->value(function (Priority $priority) {
                        return $priority->color;
                    })
                    ->attributes([
                        'class' => 'select2-color',
                    ]);
            });
        });
    }
public function form ( Priority $ priority ) { return $ this -> form -> of ( 'work-orders.priorities' , function ( FormGrid $ form ) use ( $ priority ) { if ( $ priority -> exists ) { $ url = route ( 'maintenance.work-orders.priorities.update' , [ $ priority -> getKey ( ) ] ) ; $ method = 'PATCH' ; $ form -> submit = 'Save' ; } else { $ url = route ( 'maintenance.work-orders.priorities.store' ) ; $ method = 'POST' ; $ form -> submit = 'Create' ; } $ colors = config ( 'maintenance.colors' , [ ] ) ; $ form -> attributes ( compact ( 'method' , 'url' ) ) ; $ form -> with ( $ priority ) ; $ form -> fieldset ( function ( Fieldset $ fieldset ) use ( $ colors ) { $ fieldset -> control ( 'input:text' , 'name' ) -> attributes ( [ 'placeholder' => 'ex. High / Low' , ] ) ; $ fieldset -> control ( 'select' , 'color' ) -> options ( $ colors ) -> value ( function ( Priority $ priority ) { return $ priority -> color ; } ) -> attributes ( [ 'class' => 'select2-color' , ] ) ; } ) ; } ) ; }
Returns a new form for priorities.

@param Priority $priority

@return \Orchestra\Contracts\Html\Builder
Returns a new form for priorities .