public function editCustomRecord($parameters)
 {
     // get resourse to know if set user, depend of view, todos or user todos
     $actions = $this->request->route()->getAction();
     $parameters['resource'] = $actions['resource'];
     if ($parameters['object']->type_id_093 == 2) {
         $response = FacturaDirecta::getClient($parameters['object']->customer_id_093);
         $collection = collect();
         // check that response does not contain httpStatus 404
         if (!isset($response['httpStatus'])) {
             // set id like integer, to compare in select
             $response['id'] = (int) $response['id'];
             $parameters['customers'] = $collection->push(Miscellaneous::arrayToObject($response));
         }
     }
     // types
     $parameters['types'] = array_map(function ($object) {
         $object->name = trans_choice($object->name, 1);
         return $object;
     }, config('projects.types'));
     // projects
     $parameters['projects'] = Project::builder()->where('end_date_090', '>', date('U'))->orWhereNull('end_date_090')->get();
     // todo: cambiar por listado de programadores
     $users = User::builder()->get();
     $parameters['users'] = $users->map(function ($user, $key) {
         $user->name = $user->name_010 . ' ' . $user->surname_010;
         return $user;
     });
     return $parameters;
 }
 public function editCustomRecord($parameters)
 {
     $response = FacturaDirecta::getClient($parameters['object']->customer_id_090);
     $collection = collect();
     // check that response does not contain httpStatus 404
     if (!isset($response['httpStatus'])) {
         // set id like integer, to compare in select
         $response['id'] = (int) $response['id'];
         $parameters['customers'] = $collection->push(Miscellaneous::arrayToObject($response));
     }
     return $parameters;
 }
 public function editCustomRecord($parameters)
 {
     $parameters['campaigns'] = Campaign::builder()->where('active_221', true)->get();
     $parameters['products'] = Product::builder()->where('lang_id_112', base_lang()->id_001)->get();
     $parameters['places'] = Place::builder()->get();
     $productPrefixes = ProductPrefix::all();
     $parameters['products']->map(function ($item, $key) use($productPrefixes) {
         // set prefix products
         $productPrefix = $productPrefixes->where('product_id_222', $item->id_111)->first();
         if ($productPrefix == null) {
             return $item->prefix_222 = null;
         }
         return $item->prefix_222 = $productPrefixes->where('product_id_222', $item->id_111)->first()->prefix_222;
     });
     $response = FacturaDirecta::getInvoice($parameters['object']->invoice_id_226);
     $collection = collect();
     // check that response does not contain httpStatus 404
     if (!isset($response['httpStatus'])) {
         // set id like integer, to compare in select
         $response['id'] = (int) $response['id'];
         $parameters['invoices'] = $collection->push(Miscellaneous::arrayToObject($response));
     }
     // objects from place
     if (isset($parameters['object']->place_id_226)) {
         $result = collect(config('booking.models'))->where('id', $parameters['object']->place_id_226);
         if (count($result) === 0) {
             return response()->json(['status' => 'error', 'code' => 404, 'message' => 'Records not found']);
         }
         // model constructor
         $model = App::make($result->first()->model);
         // use sofa to get lang from lang table of object query
         $parameters['objects'] = $model->builder()->where('lang_id', base_lang()->id_001)->get();
         $parameters['objectName'] = trans_choice($result->first()->name, 1);
     }
     return $parameters;
 }
 public function getInvoices(Request $request)
 {
     $fdInvoices = FacturaDirecta::getInvoices($request->all());
     return response()->json($fdInvoices);
 }