getRouteKey(); } public function title() { if ($this->title != '') { return $this->title; } if ($this->name != '') { return $this->name; } return 'None'; } public function toArray($request) { return [ 'id' => $this->getRouteKey(), 'title' => $this->title(), 'slug' => $this->slug, 'filing_type' => $this->filing_type, 'business_id' => $this->business_id, 'tax_period' => $this->tax_period, 'first_used_month' => $this->first_used_month, 'final_return' => $this->final_return, 'tax_amount' => $this->tax_amount, 'tax_year_end_month' => $this->tax_year_end_month, 'loss_event' => $this->loss_event, 'sold_on' => $this->sold_on, 'used_for_logging' => $this->used_for_logging, 'explanation' => $this->explanation, 'attachment' => $this->attachment, 'sold_to_name' => $this->sold_to_name, 'sold_to_phone' => $this->sold_to_phone, 'sold_to_email' => $this->sold_to_email, 'sold_to_address1' => $this->sold_to_address1, 'sold_to_address2' => $this->sold_to_address2, 'sold_to_country' => $this->sold_to_country, 'sold_to_state' => $this->sold_to_state, 'sold_to_city' => $this->sold_to_city, 'sold_to_zip' => $this->sold_to_zip, 'service_fee' => $this->service_fee, 'subtotal' => $this->subtotal, 'sales_tax' => $this->sales_tax, 'total' => $this->total, 'bill_to_card' => $this->bill_to_card, 'status' => $this->status, 'user_id' => $this->user_id, 'slug' => $this->slug, 'created_at' => !is_null($this->created_at) ? $this->created_at->format('Y-m-d H:i:s') : null, 'updated_at' => !is_null($this->updated_at) ? $this->updated_at->format('Y-m-d H:i:s') : null, 'meta' => [ 'exists' => $this->exists(), 'link' => $this->itemLink(), 'upload_url' => $this->getUploadURL(''), 'workflow' => $this->workflows(), 'actions' => $this->actions(), ], ]; } /** * Get additional data that should be returned with the resource array. * * @param \Illuminate\Http\Request $request * @return array */ public function with($request) { return [ 'meta' => [ 'exists' => $this->exists(), 'link' => $this->itemLink(), 'upload_url' => $this->getUploadURL(''), 'workflow' => $this->workflows(), 'actions' => $this->actions(), ], ]; } /** * Get the workflows for the resource. * * @return array */ private function workflows() { $arr = []; return $arr; } /** * Get the actions for the resource. * * @return array */ private function actions() { $arr = []; $actions = $this->resource->actions()->details(); foreach ($actions as $key => $action) { $name = $action->name(); $arr[$key]['url'] = guard_url('filing/filing//action' . $this->getRouteKey() . '/' . $action->name()); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $action->form(); $arr[$key]['label'] = trans('filing::filing.actions.' . $name); } return $arr; } }