public function update($id) { $oss = Oss::find($id); $oss->tanggal_oss = Carbon::createFromFormat('d/m/Y', Input::get('tanggal_oss')); $oss->no_oss = Input::get('no_oss'); $oss->mitra_oss = Input::get('mitra_oss'); if (Input::get('nama_bantek') != '') { $oss->nama_bantek_oss = Input::get('nama_bantek'); } $oss->id_site = Input::get('id_site'); $oss->nama_site = Input::get('nama_site'); if (Input::get('tanggal_mulai') != '') { $oss->tanggal_mulai_oss = Carbon::createFromFormat('d/m/Y', Input::get('tanggal_mulai')); } if (Input::get('tanggal_selesai') != '') { $oss->tanggal_selesai_oss = Carbon::createFromFormat('d/m/Y', Input::get('tanggal_selesai')); } $oss->permasalahan_oss = Input::get('masalah'); $oss->action_oss = Input::get('action'); if (Input::get('rincian') != '') { $oss->rincian_jasa_material_oss = Input::get('rincian'); } if (Input::get('shopping_list') != '') { $oss->kode_shopping_list = Input::get('shopping_list'); } $oss->harga_oss = Input::get('harga'); $oss->req_oleh = Input::get('request'); $oss->diketahui_oleh = Input::get('approval'); $oss->save(); Session::flash('success', 'Data has been saved'); return Redirect::to('/oss'); }
public function getIncompleteProductLoads($user_id) { //get user and in progress product requests / ideas $user = $this->eloquent->with(['ideas' => function ($query) { $query->where('is_fulfilled', '=', 0); }])->with(['productRequests' => function ($query) { $query->whereNull('product_id'); }])->find($user_id); if (empty($user)) { return []; } $user = $user->toArray(); $product_requests = $user['product_requests']; $ideas = $user['ideas']; //compile inprogress items $inprogress_items = new \Collection(); foreach ($product_requests as $product_request) { $inprogress_items->add(['type' => 'id load', 'human_time_diff' => \Carbon::createFromFormat('Y-m-d H:i:s', $product_request['created_at'])->diffForHumans(), 'created_at' => $product_request['created_at'], 'updated_at' => $product_request['updated_at'], 'id' => $product_request['id'], 'description' => $product_request['vendor'] . ' ' . $product_request['vendor_id'], 'query' => ['vendor' => $product_request['vendor'], 'vendor_id' => $product_request['vendor_id']]]); } foreach ($ideas as $idea) { $inprogress_items->add(['type' => 'idea load', 'human_time_diff' => \Carbon::createFromFormat('Y-m-d H:i:s', $idea['created_at'])->diffForHumans(), 'created_at' => $idea['created_at'], 'updated_at' => $idea['updated_at'], 'id' => $idea['id'], 'description' => $idea['description'], 'query' => ['idea_description' => $idea['description']]]); } $inprogress_items->sortBy('created_at'); return $inprogress_items->toArray(); }
/** * @param $configdepart * @return bool */ private function saveFlights(Configdepart $configdepart) { // Combien de flights à créer $nbFlights = ceil($configdepart->nbjoueurs / $configdepart->slotbyflight) + $configdepart->startergap; // Met a jour Configdepart->slotcount : nombre de places disponibes créees $configdepart->slotcount = $nbFlights * $configdepart->slotbyflight; $configdepart->save(); // Supprimer les Flight de cette config $configdepart->flights()->delete(); // Boucle tous les flight à créer for ($i = 1; $i <= $nbFlights; $i++) { $addMinutes = ($i - 1) * $configdepart->interval; $newheure = Carbon::createFromFormat('H:i', $configdepart->startheure)->addMinutes($addMinutes); // New Flight $flight = new Flight(); $flight->configdepart_id = $configdepart->id; $flight->num = $i; $flight->heure = $newheure; $flight->save(); // Cree les slots for ($slotnum = 1; $slotnum <= $configdepart->slotbyflight; $slotnum++) { $slot = new Slot(); $slot->flight_id = $flight->id; $slot->num = $slotnum; $slot->entree_id = 0; $slot->save(); } } return true; }
protected function __parseXMLDocument() { $xml = new SimpleXMLElement($this->xmlDocument); $this->date = Carbon::createFromFormat('Y-m-d', (string) $xml->Body->Cube['date']); foreach ($xml->Body->Cube->Rate as $line) { $this->currency[] = array("name" => $line["currency"], "value" => $line, "multiplier" => $line["multiplier"]); } }
/** * показываем список транзакций за указанную дату для текущего пользователя * * @return \Illuminate\Http\Response */ public function getList($date = '') { $date = $date ?: date("Y-m-d"); $start = \Carbon::createFromFormat("Y-m-d", $date)->startOfDay()->toDateTimeString(); $end = \Carbon::createFromFormat("Y-m-d", $date)->endOfDay()->toDateTimeString(); // return ['content' => Transaction::with('card')->where('user_id', $this->user->id)->where('created_at', '>=', $start)->where('created_at', '<=', $end)->orderBy('created_at', 'DESC')->get()]; }
public function getEdad() { try { $cb_date = Carbon::createFromFormat('d/m/Y', Input::get('fecha_nacimiento')); return Response::json(['edad' => $cb_date->age]); } catch (InvalidArgumentException $e) { return Response::json(['edad' => '']); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $s3 = AWS::get('s3'); $s3Bucket = 'buildbrighton-bbms'; if (Request::hasFile('image')) { $file = Request::file('image'); $event = Request::get('textevent'); $time = Request::get('time'); $fileData = Image::make($file)->encode('jpg', 80); $date = Carbon::createFromFormat('YmdHis', $event); $folderName = $date->hour . ':' . $date->minute . ':' . $date->second; try { $newFilename = \App::environment() . '/cctv/' . $date->year . '/' . $date->month . '/' . $date->day . '/' . $folderName . '/' . $time . '.jpg'; $s3->putObject(array('Bucket' => $s3Bucket, 'Key' => $newFilename, 'Body' => $fileData, 'ACL' => 'public-read', 'ContentType' => 'image/jpg', 'ServerSideEncryption' => 'AES256')); } catch (\Exception $e) { \Log::exception($e); } //Log::debug('Image saved :https://s3-eu-west-1.amazonaws.com/buildbrighton-bbms/'.$newFilename); } if (Request::get('eventend') == 'true') { $event = Request::get('textevent'); $date = Carbon::createFromFormat('YmdHis', $event); $folderName = $date->hour . ':' . $date->minute . ':' . $date->second; $iterator = $s3->getIterator('ListObjects', array('Bucket' => $s3Bucket, 'Prefix' => \App::environment() . '/cctv/' . $date->year . '/' . $date->month . '/' . $date->day . '/' . $folderName)); $images = []; $imageDurations = []; foreach ($iterator as $object) { $images[] = 'https://s3-eu-west-1.amazonaws.com/buildbrighton-bbms/' . $object['Key']; $imageDurations[] = 35; } if (count($images) <= 2) { //only two images, probably two bad frames //delete them foreach ($iterator as $object) { Log::debug("Deleting small event image " . $object['Key']); $s3->deleteObject(['Bucket' => $s3Bucket, 'Key' => $object['Key']]); } return; } $gc = new GifCreator(); $gc->create($images, $imageDurations, 0); $gifBinary = $gc->getGif(); //Delete the individual frames now we have the gif foreach ($iterator as $object) { //Log::debug("Processed gif, deleting frame, ".$object['Key']); $s3->deleteObject(['Bucket' => $s3Bucket, 'Key' => $object['Key']]); } //Save the gif $newFilename = \App::environment() . '/cctv/' . $date->year . '/' . $date->month . '/' . $date->day . '/' . $folderName . '.gif'; $s3->putObject(array('Bucket' => $s3Bucket, 'Key' => $newFilename, 'Body' => $gifBinary, 'ACL' => 'public-read', 'ContentType' => 'image/gif', 'ServerSideEncryption' => 'AES256')); //Log::debug('Event Gif generated :https://s3-eu-west-1.amazonaws.com/buildbrighton-bbms/'.$newFilename); \Slack::to("#cctv")->attach(['image_url' => 'https://s3-eu-west-1.amazonaws.com/buildbrighton-bbms/' . $newFilename, 'color' => 'warning'])->send('Movement detected'); } }
function is_date_btw($key, $start_date, $end_date) { $key = Carbon::createFromFormat('Y-m-d', $key); $start_date = Carbon::createFromFormat('Y-m-d', $start_date); $end_date = Carbon::createFromFormat('Y-m-d', $end_date); if ($key->gte($start_date) && $key->lte($end_date)) { return true; } else { return false; } }
public static function delocalize($date) { if (!isset($date) or gettype($date) == 'object') { return $date; } else { if ($date == "") { return null; } } return Carbon::createFromFormat(trans('date.formats.default'), $date); }
/** * @return array Mutates the filter values so that it is readily prepared for processing. */ public function getMutatedValues() { $operator = head($this->values); $dates = explode(' - ', last($this->values)); switch ($operator) { case 'before': return [DateRange::before(Carbon::createFromFormat(Filterable::$date_format, head($dates), 'GB')->startOfDay())]; case 'in': return [new DateRange(Carbon::createFromFormat(Filterable::$date_format, head($dates), 'GB')->subDay()->endOfDay(), Carbon::createFromFormat(Filterable::$date_format, last($dates), 'GB')->addDay()->startOfDay())]; case 'not_in': return [new DateRange(Carbon::createFromFormat(Filterable::$date_format, last($dates), 'GB')->addDay()->startOfDay(), Carbon::createFromFormat(Filterable::$date_format, head($dates), 'GB')->subDay()->endOfDay())]; case 'after': return [DateRange::after(Carbon::createFromFormat(Filterable::$date_format, last($dates), 'GB')->endOfDay())]; } }
public function update($id) { $fpl = Fpl::find($id); $fpl->nama_pemohon = Input::get('nama_pemohon'); $fpl->tanggal_permintaan = Carbon::createFromFormat('d/m/Y', Input::get('tanggal_permintaan')); $fpl->jenis_permintaan = Input::get('jenis_permintaan'); $fpl->perbaikan_pemeliharaan = Input::get('perbaikan'); $fpl->pembelian = Input::get('pembelian'); $fpl->alasan_kebutuhan = Input::get('alasan'); $fpl->jumlah_estimasi_harga = Input::get('estimasi'); $fpl->waktu_pengadaan = Carbon::createFromFormat('d/m/Y', Input::get('waktu_pengadaan')); $fpl->trx_id = Input::get('trxid'); $fpl->no_acc = Input::get('acc'); $fpl->save(); Session::flash('success', 'Data has been updated'); return Redirect::to('/fpl'); }
public function parseFilter($campo, $valor, $query) { //se verifica si hay que buscar en otras tablas if (str_contains($campo, '->')) { $arrayOps = explode('->', $campo); //relacion sencilla if (count($arrayOps) == 2) { $tabla = str_plural_spanish(explode('.', $arrayOps[0])[1]); $campo = $tabla . '.' . $arrayOps[1]; } else { if (count($arrayOps) == 3) { $tabla = str_plural_spanish($arrayOps[1]); $campo = $tabla . '.' . $arrayOps[2]; } } } //arrays aplica whereIn, integer aplica =, strings aplica like %..%, fechas aplica >= o <= y se convierten en carbon try { $fecha = \Carbon::createFromFormat('d/m/Y', $valor); $esfecha = true; } catch (\Exception $e) { $esfecha = false; } if ($esfecha) { $operador = str_contains($campo, '_desde') ? '>=' : '<='; $campo = str_replace('_desde', '', $campo); $campo = str_replace('_hasta', '', $campo); $query->where($campo, $operador, $fecha); } else { if (is_array($valor)) { $query->whereIn($campo, $valor); } else { if (is_numeric($valor)) { $query->where($campo, $valor); } else { if (is_string($valor)) { //Se usa i like para que sea insensible a mayusculas $query->where($campo, 'ILIKE', '%' . $valor . '%'); } } } } return $query; }
public function setEditableInput($key, $value) { if (isset(Config::get('users::settings_editable')[$key])) { $type = Config::get('users::settings_editable')[$key]; if ($type == "date") { $value = \Carbon::createFromFormat('Y/m/d H:i', $value); } else { if ($type == "bool") { $value = (bool) $value; } else { if ($type == "number") { $value = (int) $value; } } } $this->{$key} = $value; } return $this; }
private function set_data($route) { $this->type = $route->type; $this->id = $route->id; $this->sourceId = $route->source; $this->destinationId = $route->destination; $this->productId = $route->product; $product = $this->ci->routes_model->product($route->product); $this->product = $product->productName; $source = $this->ci->routes_model->city($route->source); $this->source = $source->cityName; $destination = $this->ci->routes_model->city($route->destination); $this->destination = $destination->cityName; $this->ci->db->order_by('id', 'desc'); $this->ci->db->where(array('route_id' => $route->id)); $this->ci->db->limit(1); $freights = $this->ci->db->get('freights')->result(); //var_dump($freights); if ($freights) { $freight = $freights[0]; $this->freight = $freight->freight; $this->startDate = $freight->startDate; $this->endDate = $freight->endDate; /*---checking is freight active----*/ $start = Carbon::createFromFormat('Y-m-d', $freight->startDate); $end = Carbon::createFromFormat('Y-m-d', $freight->endDate); $now = Carbon::createFromFormat('Y-m-d', date('Y-m-d')); $this->is_freight_active = $now->between($start, $end); $this->freight_id = $freight != null ? $freight->id : null; $this->formatted_startDate = $freight != null ? $this->ci->carbon->createFromFormat('Y-m-d', $freight->startDate)->toFormattedDateString() : null; $this->formatted_endDate = $freight != null ? $this->ci->carbon->createFromFormat('Y-m-d', $freight->endDate)->toFormattedDateString() : null; } else { $this->freight = null; $this->startDate = null; $this->endDate = null; $this->formatted_endDate = null; $this->formatted_startDate = null; $this->freight_id = null; } }
public function formatMetrics() { // get currently calculated metrics $currentMetrics = Calculator::currentMetrics(); $this->date = Carbon::createFromFormat('Y-m-d', $this->date)->format('Y-m-d, l'); // go through them foreach ($currentMetrics as $statID => $statName) { if (is_null($this->{$statID})) { $this->{$statID} = 'Not enough data'; } else { switch ($statID) { // money formats fall through case 'mrr': case 'arr': case 'arpu': // divide the value by 100 $this->{$statID} /= 100; // format it into money setlocale(LC_MONETARY, 'en_US'); $this->{$statID} = money_format('%n', $this->{$statID}); break; // percent formats fall through // percent formats fall through case 'uc': $this->{$statID} = $this->{$statID} . '%'; break; // pieces formats fall through // pieces formats fall through case 'cancellations': case 'au': break; default: break; } // /switch } // /if } // /foreach }
?> <?php foreach ($group as $record) { ?> <tr> <td><?php echo $record->source; ?> </td> <td><?php echo $record->destination; ?> </td> <td><?php echo $record->invoice_date == '0000-00-00' ? 'n/a' : Carbon::createFromFormat('Y-m-d', $record->invoice_date)->toFormattedDateString(); ?> </td> <td><?php echo $record->invoice_number; ?> </td> <td><?php echo $record->tanker_number; ?> </td> <td><?php echo $record->contractor; ?> </td> <td>
public function getCreatedAtAttribute($value) { $utc = Carbon::createFromFormat($this->getDateFormat(), $value); return $utc->setTimezone('America/Chicago'); }
public function get($year, $month) { $newsSummary = Object::where('subtype', MissionControlSubtype::NewsSummary)->whereRaw('YEAR(originated_at) = :year WHERE MONTH(originated_at) = :month', ['year' => $year, 'month' => $month])->firstOrFail(); return view('newsSummary', ['newsSummary' => $newsSummary, 'year' => $year, 'month' => Carbon::createFromFormat($month, 'm')->format('F')]); }
public function getDateAttribute($value) { if ($value) { return Carbon::createFromFormat('Y-m-d', $value)->format('m/d/Y'); } }
public function getRegisterAccount($post = NULL) { $user = new User(); if (!is_null($post)) { $user->group_id = Group::where('name', 'participant')->pluck('id'); $user->name = $post['name']; $user->surname = $post['surname']; $user->email = $post['email']; $user->active = 1; $user->phone = $post['phone']; $user->sex = $post['sex']; $bdate = Carbon::createFromFormat('Y-m-d', $post['yyyy'] . '-' . $post['mm'] . '-' . $post['dd'])->format('Y-m-d 00:00:00'); $user->bdate = $bdate; $user->city = isset($post['city']) ? $post['city'] : ''; $user->remote_id = @$post['remote_id']; $user->sessionKey = @$post['sessionKey']; $user->password = $post['password']; $user->photo = ''; $user->thumbnail = ''; $user->temporary_code = ''; $user->code_life = ''; $user->save(); $user->touch(); return $user; } return FALSE; }
case 2: echo " Not Debit"; break; case 0: echo " Credit"; break; case 3: echo " Not Credit"; break; } } if (isset($_GET['billed_from']) && $_GET['billed_from'] != '') { echo "<b> Billed From: </b>" . Carbon::createFromFormat("Y-m-d", $_GET['billed_from'])->toFormattedDateString(); } if (isset($_GET['billed_to']) && $_GET['billed_to'] != '') { echo "<b> Billed To: </b>" . Carbon::createFromFormat("Y-m-d", $_GET['billed_to'])->toFormattedDateString() . " | "; } if (isset($_GET['bill_status']) && $_GET['bill_status'] != '') { echo "<b> Bill Status: </b>"; switch ($_GET['bill_status']) { case 1: echo " Billed"; break; case 0: echo " Not Billed"; break; } } ?> </div> </div>
public function setPublishedAtAttribute($date) { $this->attributes['published_at'] = Carbon::createFromFormat('Y-m-d', $date); }
public function setPublishedAtAttribute($date) { $this->attributes['event_date'] = Carbon::createFromFormat('Y-m-d', $date); // lägger till tiden på datumet. }
return true; } return false; } public function edit_pin($for = 'trip') { $pass = ''; switch ($for) { case 'trip':
$total_contractor_freight_amount = 0; $total_contractor_net_freight_amount = 0; $total_paid_to_contractor = 0; $total_contractor_remaining = 0; ?> <?php $parent_count = 0; ?> <?php foreach ($accounts as $trip) { ?> <?php $count = 0; $num_trip_product_details = sizeof($trip->trip_related_details); ?> <?php foreach ($trip->trip_related_details as $detail) { ?> <?php $count++; $parent_count++; ?> <tr style="border-top: <?php echo $count == 1 ? '3' : '0'; ?> px solid lightblue;"> <!--first column--> <?php if (in_array('id', $columns) == true) { ?>
public function setFechaNacimientoAttribute($value) { if ($value != "") { $value = str_replace('/', '-', $value); $value = date_create($value); $value = date_format($value, 'Y-m-d'); $this->attributes['fecha_nacimiento'] = Carbon::createFromFormat('Y-m-d', $value)->toDateString(); } }
echo in_array('trip_date', $columns) == true ? "<td> Date </td>" : ""; ?> <?php echo in_array('tanker', $columns) == true ? "<td>Tanker </td>" : ""; ?> <?php echo in_array('capacity', $columns) == true ? "<td>Capacity </td>" : ""; ?> <?php echo in_array('contractor', $columns) == true ? "<td> Contractor </td>" : ""; ?> <?php echo in_array('customer', $columns) == true ? "<td>Customer</td>" : ""; ?> <?php echo in_array('company', $columns) == true ? "<td>Company</td>" : ""; ?> <?php echo in_array('source', $columns) == true ? "<td>Source </td>" : ""; ?> <?php echo in_array('destination', $columns) == true ? "<td>Destination </td>" : ""; ?> <?php echo in_array('product', $columns) == true ? "<td>Product </td>" : ""; ?> <?php echo in_array('product_quantity', $columns) == true ? "<td>Product Quantity </td>" : ""; ?> <?php echo in_array('stn', $columns) == true ? "<td>STN-Number</td>" : "";
/** * @param $date * @param $interval * @param string $operator * @param string $dateFormat * @return bool */ private function isWithInterval($date, $interval, $operator = '=', $dateFormat = 'Y-m-d') { $now = Carbon::now(); $date = Carbon::createFromFormat($dateFormat, $date); switch (strtoupper($interval[1])) { case 'D': $date->addDays($interval[0]); break; case 'M': $date->addMonths($interval[0]); break; default: $date->addYears($interval[0]); } return $this->compare($now, $operator, $date); }
<link href="<?php echo css(); ?> bootstrap.min.css" rel="stylesheet"> </head> <style> .white-popup { position: relative; background: #FFF; padding: 20px; width: auto; max-width: 1000px; margin: 20px auto; } table{ font-size: <?php echo $font_size; ?> ; } table td, th{ padding: 5px; } </style> <script> function show_monthly_results(month, path){ var path = path+month; window.location.href = path; } </script> <div id="page-wrapper" style="min-height: 700px;">
/** * Get the date the user was created. * * @return string */ public function joined() { return String::date(Carbon::createFromFormat('Y-n-j G:i:s', $this->created_at)); }