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

            $categories = Category::getSelectHierarchy('assets');
            $locations = Location::getSelectHierarchy();

            $form->resource($this, $route, $asset, compact('method'));

            $form->fieldset(function (Fieldset $fieldset) use ($categories, $locations) {
                $fieldset
                    ->control('input:text', 'tag')
                    ->attributes([
                        'placeholder' => 'ex. 100010',
                    ]);

                $fieldset
                    ->control('input:text', 'name')
                    ->attributes([
                        'placeholder' => 'ex. Ford F150',
                    ]);

                $fieldset
                    ->control('select', 'category')
                    ->options($categories)
                    ->value(function (Asset $asset) {
                        return $asset->category_id;
                    });

                $fieldset
                    ->control('select', 'location')
                    ->options($locations)
                    ->value(function (Asset $asset) {
                        return $asset->location_id;
                    });

                $fieldset->control('input:textarea', 'description');

                $fieldset->control('select', 'condition')
                    ->options(trans('assets.conditions'))
                    ->value(function (Asset $asset) {
                        return $asset->condition_number;
                    });

                $fieldset->control('input:text', 'vendor')
                    ->attributes([
                        'placeholder' => 'ex. Ford',
                    ]);

                $fieldset->control('input:text', 'make')
                    ->attributes([
                        'placeholder' => 'ex. F',
                    ]);

                $fieldset->control('input:text', 'model')
                    ->attributes([
                        'placeholder' => 'ex. 150',
                    ]);

                $fieldset->control('input:text', 'serial')
                    ->attributes([
                        'placeholder' => 'ex. 153423-13432432-2342423',
                    ]);

                $fieldset->control('input:text', 'size')
                    ->attributes([
                        'placeholder' => 'ex. 1905 x 2463',
                    ]);

                $fieldset->control('input:text', 'weight')
                    ->attributes([
                        'placeholder' => 'ex. 1 Ton',
                    ]);

                $fieldset->control('input:text', 'acquired_at')
                    ->attributes([
                        'class'       => 'pickadate',
                        'placeholder' => 'Click to Select a Date',
                    ]);

                $fieldset->control('input:text', 'end_of_life')
                    ->attributes([
                        'class'       => 'pickadate',
                        'placeholder' => 'Click to Select a Date',
                    ]);
            });
        });
    }
public function form(Asset $asset)
    {
        return $this->form->of('assets', function (FormGrid $form) use ($asset) {
            if ($asset->exists) {
                $method = 'PATCH';
                $route = route('maintenance.assets.update', [$asset->getKey()]);
                $form->submit = 'Save';
            } else {
                $method = 'POST';
                $route = route('maintenance.assets.store');
                $form->submit = 'Create';
            }

            $categories = Category::getSelectHierarchy('assets');
            $locations = Location::getSelectHierarchy();

            $form->resource($this, $route, $asset, compact('method'));

            $form->fieldset(function (Fieldset $fieldset) use ($categories, $locations) {
                $fieldset
                    ->control('input:text', 'tag')
                    ->attributes([
                        'placeholder' => 'ex. 100010',
                    ]);

                $fieldset
                    ->control('input:text', 'name')
                    ->attributes([
                        'placeholder' => 'ex. Ford F150',
                    ]);

                $fieldset
                    ->control('select', 'category')
                    ->options($categories)
                    ->value(function (Asset $asset) {
                        return $asset->category_id;
                    });

                $fieldset
                    ->control('select', 'location')
                    ->options($locations)
                    ->value(function (Asset $asset) {
                        return $asset->location_id;
                    });

                $fieldset->control('input:textarea', 'description');

                $fieldset->control('select', 'condition')
                    ->options(trans('assets.conditions'))
                    ->value(function (Asset $asset) {
                        return $asset->condition_number;
                    });

                $fieldset->control('input:text', 'vendor')
                    ->attributes([
                        'placeholder' => 'ex. Ford',
                    ]);

                $fieldset->control('input:text', 'make')
                    ->attributes([
                        'placeholder' => 'ex. F',
                    ]);

                $fieldset->control('input:text', 'model')
                    ->attributes([
                        'placeholder' => 'ex. 150',
                    ]);

                $fieldset->control('input:text', 'serial')
                    ->attributes([
                        'placeholder' => 'ex. 153423-13432432-2342423',
                    ]);

                $fieldset->control('input:text', 'size')
                    ->attributes([
                        'placeholder' => 'ex. 1905 x 2463',
                    ]);

                $fieldset->control('input:text', 'weight')
                    ->attributes([
                        'placeholder' => 'ex. 1 Ton',
                    ]);

                $fieldset->control('input:text', 'acquired_at')
                    ->attributes([
                        'class'       => 'pickadate',
                        'placeholder' => 'Click to Select a Date',
                    ]);

                $fieldset->control('input:text', 'end_of_life')
                    ->attributes([
                        'class'       => 'pickadate',
                        'placeholder' => 'Click to Select a Date',
                    ]);
            });
        });
    }
public function form ( Asset $ asset ) { return $ this -> form -> of ( 'assets' , function ( FormGrid $ form ) use ( $ asset ) { if ( $ asset -> exists ) { $ method = 'PATCH' ; $ route = route ( 'maintenance.assets.update' , [ $ asset -> getKey ( ) ] ) ; $ form -> submit = 'Save' ; } else { $ method = 'POST' ; $ route = route ( 'maintenance.assets.store' ) ; $ form -> submit = 'Create' ; } $ categories = Category :: getSelectHierarchy ( 'assets' ) ; $ locations = Location :: getSelectHierarchy ( ) ; $ form -> resource ( $ this , $ route , $ asset , compact ( 'method' ) ) ; $ form -> fieldset ( function ( Fieldset $ fieldset ) use ( $ categories , $ locations ) { $ fieldset -> control ( 'input:text' , 'tag' ) -> attributes ( [ 'placeholder' => 'ex. 100010' , ] ) ; $ fieldset -> control ( 'input:text' , 'name' ) -> attributes ( [ 'placeholder' => 'ex. Ford F150' , ] ) ; $ fieldset -> control ( 'select' , 'category' ) -> options ( $ categories ) -> value ( function ( Asset $ asset ) { return $ asset -> category_id ; } ) ; $ fieldset -> control ( 'select' , 'location' ) -> options ( $ locations ) -> value ( function ( Asset $ asset ) { return $ asset -> location_id ; } ) ; $ fieldset -> control ( 'input:textarea' , 'description' ) ; $ fieldset -> control ( 'select' , 'condition' ) -> options ( trans ( 'assets.conditions' ) ) -> value ( function ( Asset $ asset ) { return $ asset -> condition_number ; } ) ; $ fieldset -> control ( 'input:text' , 'vendor' ) -> attributes ( [ 'placeholder' => 'ex. Ford' , ] ) ; $ fieldset -> control ( 'input:text' , 'make' ) -> attributes ( [ 'placeholder' => 'ex. F' , ] ) ; $ fieldset -> control ( 'input:text' , 'model' ) -> attributes ( [ 'placeholder' => 'ex. 150' , ] ) ; $ fieldset -> control ( 'input:text' , 'serial' ) -> attributes ( [ 'placeholder' => 'ex. 153423-13432432-2342423' , ] ) ; $ fieldset -> control ( 'input:text' , 'size' ) -> attributes ( [ 'placeholder' => 'ex. 1905 x 2463' , ] ) ; $ fieldset -> control ( 'input:text' , 'weight' ) -> attributes ( [ 'placeholder' => 'ex. 1 Ton' , ] ) ; $ fieldset -> control ( 'input:text' , 'acquired_at' ) -> attributes ( [ 'class' => 'pickadate' , 'placeholder' => 'Click to Select a Date' , ] ) ; $ fieldset -> control ( 'input:text' , 'end_of_life' ) -> attributes ( [ 'class' => 'pickadate' , 'placeholder' => 'Click to Select a Date' , ] ) ; } ) ; } ) ; }
Returns a new form for the specified asset.

@param Asset $asset

@return \Orchestra\Contracts\Html\Builder
Returns a new form for the specified asset .