public function form(Inventory $item, InventoryStock $stock)
    {
        return $this->form->of('inventory.stocks', function (FormGrid $form) use ($item, $stock) {
            if ($stock->exists) {
                $method = 'PATCH';
                $url = route('maintenance.inventory.stocks.update', [$item->getKey(), $stock->getKey()]);
                $form->submit = 'Save';
            } else {
                $method = 'POST';
                $url = route('maintenance.inventory.stocks.store', [$item->getKey()]);
                $form->submit = 'Create';
            }

            $locations = Location::getSelectHierarchy();

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

            $form->fieldset(function (Fieldset $fieldset) use ($locations) {
                $fieldset
                    ->control('select', 'location')
                    ->value(function (InventoryStock $stock) {
                        return $stock->location_id;
                    })
                    ->options($locations);

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

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

                $fieldset
                    ->control('input:text', 'cost')
                    ->attributes([
                        'placeholder' => 'ex. 15.00',
                    ]);
            });
        });
    }
public function form(Inventory $item, InventoryStock $stock)
    {
        return $this->form->of('inventory.stocks', function (FormGrid $form) use ($item, $stock) {
            if ($stock->exists) {
                $method = 'PATCH';
                $url = route('maintenance.inventory.stocks.update', [$item->getKey(), $stock->getKey()]);
                $form->submit = 'Save';
            } else {
                $method = 'POST';
                $url = route('maintenance.inventory.stocks.store', [$item->getKey()]);
                $form->submit = 'Create';
            }

            $locations = Location::getSelectHierarchy();

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

            $form->fieldset(function (Fieldset $fieldset) use ($locations) {
                $fieldset
                    ->control('select', 'location')
                    ->value(function (InventoryStock $stock) {
                        return $stock->location_id;
                    })
                    ->options($locations);

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

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

                $fieldset
                    ->control('input:text', 'cost')
                    ->attributes([
                        'placeholder' => 'ex. 15.00',
                    ]);
            });
        });
    }
public function form ( Inventory $ item , InventoryStock $ stock ) { return $ this -> form -> of ( 'inventory.stocks' , function ( FormGrid $ form ) use ( $ item , $ stock ) { if ( $ stock -> exists ) { $ method = 'PATCH' ; $ url = route ( 'maintenance.inventory.stocks.update' , [ $ item -> getKey ( ) , $ stock -> getKey ( ) ] ) ; $ form -> submit = 'Save' ; } else { $ method = 'POST' ; $ url = route ( 'maintenance.inventory.stocks.store' , [ $ item -> getKey ( ) ] ) ; $ form -> submit = 'Create' ; } $ locations = Location :: getSelectHierarchy ( ) ; $ form -> with ( $ stock ) ; $ form -> attributes ( compact ( 'method' , 'url' ) ) ; $ form -> fieldset ( function ( Fieldset $ fieldset ) use ( $ locations ) { $ fieldset -> control ( 'select' , 'location' ) -> value ( function ( InventoryStock $ stock ) { return $ stock -> location_id ; } ) -> options ( $ locations ) ; $ fieldset -> control ( 'input:text' , 'quantity' ) -> attributes ( [ 'placeholder' => 'ex. 45' , ] ) ; $ fieldset -> control ( 'input:text' , 'reason' ) -> attributes ( [ 'placeholder' => 'ex. Stock Update' , ] ) ; $ fieldset -> control ( 'input:text' , 'cost' ) -> attributes ( [ 'placeholder' => 'ex. 15.00' , ] ) ; } ) ; } ) ; }
Returns a new form of the specified inventory stock.

@param Inventory      $item
@param InventoryStock $stock

@return \Orchestra\Contracts\Html\Builder
Returns a new form of the specified inventory stock .