app/Warehouse.php
/**
     * check that the passed warehouse is avaliable in db
     *
     * @return id of valid warehouse|bool
     */
check that the passed warehouse is avaliable in db
@return id of valid warehouse|bool
check that the passed warehouse is avaliable in db @return id of valid warehouse|bool
public function isValidWarehouse(string $warehouse) {
        $warehouse = strtolower($warehouse);
        $warehouses = $this->pluck('name')->toArray();
        $warehouses = array_map('trim', array_map('strtolower', $warehouses));
        if (in_array($warehouse, $warehouses)) {
            $warehouse = $this->where('name', $warehouse)->first();
            return $warehouse->id;
        }
        return false;
    }
public function isValidWarehouse ( string $ warehouse ) { $ warehouse = strtolower ( $ warehouse ) ; $ warehouses = $ this -> pluck ( 'name' ) -> toArray ( ) ; $ warehouses = array_map ( 'trim' , array_map ( 'strtolower' , $ warehouses ) ) ; if ( in_array ( $ warehouse , $ warehouses ) ) { $ warehouse = $ this -> where ( 'name' , $ warehouse ) -> first ( ) ; return $ warehouse -> id ; } return false ; }
check that the passed warehouse is avaliable in db
 @return id of valid warehouse|bool
check that the passed warehouse is avaliable in db @return id of valid warehouse|bool