/** * Get Faq By Id * @param string $id * @return Hexcores\Api\Facades\Response */ public function getFaq($id) { $faq = $this->model->find($id); if (!$faq) { return response_missing(); } return response_ok($this->transform($faq, new FaqTransformer())); }
/** * get Single data of UpperHouse geo location by mongo id * @param string $id * @return Hexcores\Api\Facades\Response */ public function getById($id) { $geo = $this->model->find($id); if (!$geo) { return response_missing(); } return response_ok($this->transform($geo, new GeoTransformer())); }
/** * Attempt to use this token to login. * * @param string $token * @throws InvalidTokenStringException If token is not found or expired * * @return Definitely246\LoginToken\Models\LoginToken */ public function attempt($tokenString) { if (!$tokenString) { throw new EmptyTokenException("Cannot look up a token from empty token string."); } $token = $this->token->find($tokenString); if (!$token) { throw new InvalidTokenException("This token string could not be found!"); } if ($token->isExpired()) { throw new ExpiredTokenException("This token string has expired!", $token); } return $token; }
/** * Display a listing of the resource. * * @return Response */ public function index($id, Request $request) { $date = $request->get('date', date('Y-m-d')); $ksos = $this->ksos->join('fleets', 'ksos.fleet_id', '=', 'fleets.id')->where('ksos.pool_id', Auth::user()->pool_id)->where('ksos.actived', 1)->orderBy('fleets.taxi_number')->get(['ksos.*', 'fleets.taxi_number']); $total = DB::table('checkins')->select(DB::raw('sum(if((checkin_financials.financial_type_id = 1),checkin_financials.amount,0)) AS setoran_wajib,sum(if((checkin_financials.financial_type_id = 2),checkin_financials.amount,0)) AS tabungan_sparepart,sum(if((checkin_financials.financial_type_id = 3),checkin_financials.amount,0)) AS denda,sum(if((checkin_financials.financial_type_id = 4),checkin_financials.amount,0)) AS potongan,sum(if((checkin_financials.financial_type_id = 5),checkin_financials.amount,0)) AS cicilan_sparepart,sum(if((checkin_financials.financial_type_id = 6),checkin_financials.amount,0)) AS cicilan_ks,sum(if((checkin_financials.financial_type_id = 7),checkin_financials.amount,0)) AS biaya_cuci,sum(if((checkin_financials.financial_type_id = 8),checkin_financials.amount,0)) AS iuran_laka,sum(if((checkin_financials.financial_type_id = 9),checkin_financials.amount,0)) AS cicilan_dp_kso,sum(if((checkin_financials.financial_type_id = 10),checkin_financials.amount,0)) AS cicilan_hutang_lama,sum(if((checkin_financials.financial_type_id = 11),checkin_financials.amount,0)) AS ks,sum(if((checkin_financials.financial_type_id = 12),checkin_financials.amount,0)) AS cicilan_lain,sum(if((checkin_financials.financial_type_id = 13),checkin_financials.amount,0)) AS hutang_dp_sparepart,sum(if((checkin_financials.financial_type_id = 20),checkin_financials.amount,0)) AS setoran_cash,sum(if((checkin_financials.financial_type_id = 21),checkin_financials.amount,0)) AS tabungan,(sum(if((checkin_financials.financial_type_id = 11),checkin_financials.amount,0)) - sum(if((checkin_financials.financial_type_id = 6),checkin_financials.amount,0))) AS selisi_ks '))->addSelect(DB::raw('checkins.id, checkins.operasi_time , checkins.pool_id, checkins.shift_id'))->leftJoin('checkin_financials', 'checkins.id', '=', 'checkin_financials.checkin_id')->where('checkins.kso_id', $id)->where('checkins.operasi_time', '<=', $date)->groupBy('checkins.kso_id')->first(); $sparepart = DB::table('work_orders')->select(DB::raw('work_orders.id AS id,work_orders.kso_id AS kso_id,work_orders.wo_number AS wo_number,work_orders.fleet_id AS fleet_id,work_orders.driver_id AS driver_id,work_orders.pool_id AS pool_id,work_orders.km AS km,work_orders.complaint AS complaint,work_orders.information_complaint AS information_complaint,work_orders.status AS status,work_orders.beban AS beban,work_orders.mechanic_id AS mechanic_id,work_orders.mechanic AS mechanic,work_orders.dp_sparepart AS dp_sparepart,work_orders.user_id AS user_id,work_orders.inserted_date_set AS inserted_date_set,work_orders.finished_date_set AS finished_date_set,work_orders.fg_part_approved AS fg_part_approved,work_orders.user_approved AS user_approved,sum((wo_part_items.qty * wo_part_items.price)) AS pemakaian_part'))->leftJoin('wo_part_items', 'work_orders.id', '=', 'wo_part_items.wo_id')->where('work_orders.status', 3)->where('wo_part_items.telah_dikeluarkan', 1)->where('work_orders.beban', 0)->where('work_orders.kso_id', $id)->where('work_orders.finished_date_set', '<=', $date)->groupBy('work_orders.kso_id')->first(); $total_pemakaian_part = 0; if ($sparepart) { $total_pemakaian_part = $sparepart->pemakaian_part; } $kso = $this->ksos->find($id); $fleet = $kso->fleet; return view('armada.dashboard', compact('ksos', 'kso', 'fleet', 'total', 'total_pemakaian_part', 'date')); }
/** * Safely remove the image entity and all its presets * The physical image files are only removed after making sure that the same file is not used in other records * @param \Cake\ORM\Entity $imageEntity [description] * @return bool */ public function deleteImageEntity($imageEntity) { $shared = $this->_imagesTable->find()->where(['id !=' => $imageEntity->id, 'field_index !=' => $imageEntity->field_index, 'model' => $imageEntity->model, 'filename' => $imageEntity->filename]); if (!$shared->count()) { $basePath = $this->basePath(); (new File($basePath . DS . $imageEntity->filename))->delete(); foreach ($this->config('presets') as $preset => $options) { (new File($basePath . DS . $preset . '_' . $imageEntity->filename))->delete(); } } return $this->_imagesTable->delete($imageEntity); }
/** * Das eigentliche Parsen der Tabelle * @param [type] $table [description] * @param [type] $dates [description] * @return [type] [description] */ function tableToArr($table, $dates) { foreach ($table->find('tr') as $rowNo => $row) { if ($rowNo == 0) { continue; } foreach ($row->find('td') as $clmNo => $clm) { if ($clmNo == 0) { $categoryPrice = trim(preg_replace('/^\\D*/', '', $clm->plaintext)); $category = trim(str_replace(array($categoryPrice, "-\r\n ", "\t", "\r", "\n", " ", " "), '', $clm->plaintext)); } else { foreach ($clm->find('div.speise_eintrag') as $article) { if (empty($article)) { continue; } $title = $article->plaintext; $allergies = $price = array(); preg_match('/\\(([0-9A-Za-z,]+)\\)/', $title, $allergies); // Matcht eingeklammerten Text // Parse Allergiestoffe if (array_key_exists(1, $allergies)) { $title = str_replace($allergies[0], '', $title); } // entferne Allergiestoffe aus Titel $allergies = array_key_exists(1, $allergies) ? explode(",", trim($allergies[0], "()")) : NULL; preg_match('/(\\d{1,2},\\d{2})/', $title, $price); // Matcht Dezimalzahlen // Parse den Preis if (array_key_exists(1, $price)) { $title = str_replace($price[1], '', $title); } // entferne Preis aus Titel $price = empty($price[1]) ? $categoryPrice : $price[1]; $title = trim(str_replace(" ", " ", $title)); $price = tofloat($price); if (!array_key_exists($clmNo - 1, $dates) || empty($category) || empty($title)) { continue; } $arr[$dates[$clmNo - 1]][$category][] = array('name' => $title, 'price' => $price, 'allergies' => $allergies); unset($title, $price, $allergies); } } } } return $arr; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { return response()->json($this->repository->find($id)->delete()); }
/** * [findInDom description] * @param [type] $selector [description] * @return [type] [description] */ public function findInDom($selector) { return $this->dom->find($selector); }
/** * @Route("/repo/project/{id}/{slug}", name="front.project.show") * @Template() */ public function showAction($id) { $entity = $this->projectRepo->find($id); return ['entity' => $entity]; }