/** * [getDataList list of agency by each type of data] * @param [integer] $type [type id riainfall, water level ,dam ect.] * @return [type] [description] */ public function getDataList($type) { $agency_id = Data::getAgencyByDataType($type); $rs = Agency::getAgency($agency_id); return View::make('rbac.ajax_datalist')->with('result', $rs); }
<?php use App\Utils\Hash; use Illuminate\Support\Str; if (\User::check()) { $user = \User::getUser(); $agency = \Agency::getAgency(); } $_hash = new Hash(); $_hash = $_hash->getHasher(); ?> @extends('front.app') @section('title') {{ $job->title }}| Programme Chameleon @stop @section('content') <div id="wrapper"> @include('front.include.header') <div class="container"> <h1 class="page-header"> {{ $job->title }} - <small class="lighten"> Contractors Applied</small> </h1> <div class="row"> <div class="col-md-8"> <div class="panel panel-default"> <div class="panel-heading">Contractors Applied</div> <div class="panel-body"> <?php $contractors = $job->contractors();
public function getJobDetails() { $agency = \Agency::getAgency(); $_hash = new Hash(); $_hash = $_hash->getHasher(); $job = \Job::findJobById($_hash->decode(\Input::get('i'))); if (!$job) { return redirect()->back()->with('flashMessage', ['class' => 'danger', 'message' => 'Job does not exists.']); } if ($job->agency_id !== $agency->id) { return redirect()->back()->with('flashMessage', ['class' => 'danger', 'message' => 'You cannot edit this job.']); } return view('front.agency.job.detail')->with('job', $job); }
public function updateAvatar($file) { if (!($agency = \Agency::getAgency())) { throw new \Exception("You are not in agency account.", 1); return; } if (!is_null($agency->image)) { if (\File::exists(public_path() . '/' . $agency->image)) { \File::delete(public_path() . '/' . $agency->image); } } $uploader = new FileUploader(); $location = 'uploads/agency/' . $agency->id . '/images/' . date('m') . '/'; try { $uploadedFile = $uploader->upload($file, $location); $agency->image = $uploadedFile; $agency->updated_at = Carbon::now(); $agency->save(); session(['_sess_agency' => ['model' => $agency]]); return $agency; } catch (\Exception $e) { throw new \Exception($e->getMessage(), 1); return; } }
/** * [peerDataList return list of agency by data] * @param [type] $type [rainfall ,waterlevel,dam,temp etc.] * @return [type] [description] */ public function peerDataList($type) { $agency_id = Data::getAgencyByDataType($type); $rs = Agency::getAgency($agency_id); //var_dump($rs);exit; return View::make('peer.ajax_datalist')->with('result', $rs); }
public function testDataAgency($type) { $test = Data::getAgencyByDataType($type); $rs = Agency::getAgency($test); print '<pre>'; print_r($rs); }
public function getAgencyPaymentDone(Request $request) { if (!\Session::has('_temp_payment_sess')) { return redirect(url('agency'))->with('flashMessage', ['class' => 'danger', 'message' => 'Your session has expired, please try again.']); } $data = session('_temp_payment_sess'); $id = $request->get('paymentId'); $token = $request->get('token'); $payer_id = $request->get('PayerID'); $payment = PayPal::getById($id, $this->paypalApiContext); $paymentExecution = PayPal::PaymentExecution(); $paymentExecution->setPayerId($payer_id); $executePayment = $payment->execute($paymentExecution, $this->paypalApiContext); $agency = \Agency::getAgency(); try { switch ($data['type']) { case 'credit': \Agency::updateCredit($agency, $data['xCreditAmount']); break; case 'contract': \Agency::updateVIP($agency, true); break; default: break; } session(['_sess_agency' => ['model' => $agency]]); \Session::forget('_temp_payment_sess'); } catch (\Exception $e) { // TODO: Need better error handler // re-run try with queue? \Session::forget('_temp_payment_sess'); return redirect(url('agency'))->with('flashMessage', ['class' => 'danger', 'message' => $e->getMessage()]); } return redirect(url('agency'))->with('flashMessage', ['class' => 'success', 'message' => $data['successMessage']]); }