• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Carbon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Carbon的典型用法代码示例。如果您正苦于以下问题:PHP Carbon类的具体用法?PHP Carbon怎么用?PHP Carbon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Carbon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: dueDate

 public function dueDate()
 {
     $settings = APSetting::first();
     $generated_on = new Carbon($this->generated_on);
     $generated_on->addDays($settings->payment_due_in_days);
     return $generated_on->format('d M y');
 }
开发者ID:guilhermefilippo,项目名称:access-manager,代码行数:7,代码来源:APInvoice.php


示例2: calculateHolidays

 private function calculateHolidays($country, $fromYear, $toYear)
 {
     $return = [];
     if ($fromYear == $toYear) {
         $years = [$fromYear];
     } else {
         $years = [$fromYear, $toYear];
     }
     foreach ($years as $year) {
         $country_file = dirname(__DIR__) . '/data/' . $country . '.json';
         $countryHolidays = json_decode(file_get_contents($country_file), true);
         foreach ($countryHolidays as $countryHoliday) {
             if (strstr($countryHoliday['rule'], '%Y')) {
                 $rule = str_replace('%Y', $year, $countryHoliday['rule']);
             } elseif (strstr($countryHoliday['rule'], '%EASTER')) {
                 $date = new Carbon($year . '-03-21 +' . easter_days($year) . ' days');
                 $rule = str_replace('%EASTER', $date->format('Y-m-d'), $countryHoliday['rule']);
             } elseif (in_array($country, ['BR', 'US']) && strstr($countryHoliday['rule'], '%ELECTION')) {
                 $rule = $this->calculateElectionDay($country, $years, $year, $countryHoliday);
             } else {
                 $rule = $countryHoliday['rule'] . ' ' . $year;
             }
             if ($rule) {
                 $return[] = ['name' => $countryHoliday['name'], 'date' => new Carbon($rule)];
             }
         }
     }
     return $return;
 }
开发者ID:EventBooking,项目名称:holidayapi.com,代码行数:29,代码来源:HolidayAPIv1.php


示例3: setCreatedAt

 /**
  * Set the value of the "created at" attribute.
  *
  * @param  mixed  $value
  * @return void
  */
 public function setCreatedAt($value)
 {
     $this->{static::CREATED_AT} = $value;
     if (!$value instanceof Carbon) {
         $value = new Carbon($value);
     }
     $this->{static::CREATED_AT . '_gmt'} = $value->timezone('GMT');
 }
开发者ID:PrafullaKumarSahu,项目名称:wordpress-socializr,代码行数:14,代码来源:Comment.php


示例4: getContribute

 /**
  * Show the board index for the user.
  *
  * @return Response
  */
 public function getContribute()
 {
     $devStart = new Carbon(static::$ContributeProjectStart);
     $devCarbon = new Carbon(static::$ContributePublicStart);
     $donors = Payment::all();
     $donationsTotal = 0;
     foreach ($donors as $donor) {
         $donationsTotal += $donor->amount;
     }
     $devEnd = clone $devCarbon;
     $devTime = $donationsTotal / 100 / (double) env('CONTRIB_HOUR_COST', 10) * static::$ContributeDevInflation;
     $devEnd->addHours($devTime);
     return response()->json(['development_start' => $devStart->toRfc2822String(), 'development_public' => $devCarbon->toRfc2822String(), 'development_paid_until' => $devEnd->toRfc2822String(), 'donations_total' => $donationsTotal, 'donors' => $donors->toJson()]);
 }
开发者ID:nitogel,项目名称:infinity-next,代码行数:19,代码来源:PageController.php


示例5: postRegistro

 public function postRegistro()
 {
     $input = Input::all();
     $reglas = array('nombre' => 'required', 'apellido' => 'required', 'celular' => 'required|numeric|unique:users', 'cedula' => 'required|numeric|unique:users', 'email' => 'required|email|unique:users', 'pin' => 'required|numeric|digits_between:0,4', 'password' => 'required|numbers|case_diff|letters|min:6|confirmed', 'password_confirmation' => 'required|min:6');
     $validation = Validator::make($input, $reglas);
     if ($validation->fails()) {
         return Response::json(['success' => false, 'errors' => $validation->errors()->toArray()]);
     }
     try {
         // se guarda los datos del usuario
         $user = Sentry::register(array('first_name' => Input::get('nombre'), 'last_name' => Input::get('apellido'), 'email' => Input::get('email'), 'habilitar_pin' => 1, 'celular' => Input::get('celular'), 'cedula' => Input::get('cedula'), 'password' => Input::get('password'), 'pin' => Input::get('pin'), 'porcentaje' => 0.05, 'activated' => true));
         $userId = $user->getId();
         $token = new Token();
         $token->user_id = $userId;
         $token->api_token = hash('sha256', Str::random(10), false);
         $token->client = BrowserDetect::toString();
         $token->expires_on = Carbon::now()->addMonth()->toDateTimeString();
         $token->save();
         // Se autentica de una
         $user_login = Sentry::findUserById($userId);
         Sentry::login($user_login, false);
         return Response::json(['success' => true, 'user' => $user_login, 'token' => $token->api_token]);
     } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
         $error = array('usuario' => 'Email es requerido');
     } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         $error = array('usuario' => 'Password es requerido');
     } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
         $error = array('usuario' => 'El Email ya está registrado');
     }
     return Response::json(['success' => false, 'errors' => $error]);
 }
开发者ID:riverajefer,项目名称:bcserver,代码行数:31,代码来源:AuthController.php


示例6: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     list($rootFolder, $current, $folder) = $this->setFolder();
     $counter = 1;
     $measurementsCounter = 0;
     $file = fopen($folder . 'file' . $counter . '.csv', "w");
     $maxRows = self::MAX_ROWS - 500;
     Measurement::with('station')->where('time', '>', Carbon::now()->subMonths(3))->orderBy('time', 'asc')->chunk(500, function ($measurements) use($folder, &$file, &$measurementsCounter, &$counter, $maxRows) {
         if ($measurementsCounter > $maxRows) {
             echo "measurements: " . $measurementsCounter . "\n";
             echo "file created: " . $counter . ".csv\n";
             $measurementsCounter = 0;
             if (is_resource($file)) {
                 fclose($file);
             }
             $counter++;
             $file = fopen($folder . 'file' . $counter . '.csv', "w");
         }
         foreach ($measurements as $measurement) {
             $array = $measurement->toArray();
             unset($array['station_id'], $array['station']['id']);
             fputcsv($file, array_flatten($array));
         }
         $measurementsCounter += 500;
     });
     File::put($rootFolder . 'finished.txt', $current);
 }
开发者ID:Jarinus,项目名称:2.1-unwdmi-web,代码行数:32,代码来源:GenerateDownloadFiles.php


示例7: getIncompleteProductLoads

 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();
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:25,代码来源:EloquentUserRepository.php


示例8: sendInvoice

 public function sendInvoice(Invoice $invoice)
 {
     $invoice->load('invitations', 'client', 'account');
     $entityType = $invoice->getEntityType();
     $view = 'invoice';
     $subject = trans("texts.{$entityType}_subject", ['invoice' => $invoice->invoice_number, 'account' => $invoice->account->getDisplayName()]);
     foreach ($invoice->invitations as $invitation) {
         if (!$invitation->user->email) {
             return false;
         }
         if (!$invitation->contact->email) {
             return false;
         }
         $invitation->sent_date = \Carbon::now()->toDateTimeString();
         $invitation->save();
         $data = ['entityType' => $entityType, 'link' => $invitation->getLink(), 'clientName' => $invoice->client->getDisplayName(), 'accountName' => $invoice->account->getDisplayName(), 'contactName' => $invitation->contact->getDisplayName(), 'invoiceAmount' => Utils::formatMoney($invoice->amount, $invoice->client->currency_id), 'emailFooter' => $invoice->account->email_footer, 'showNinjaFooter' => !$invoice->account->isPro()];
         $fromEmail = $invitation->user->email;
         $fromName = $invitation->user->getDisplayName();
         $this->sendTo($invitation->contact->email, $fromEmail, $fromName, $subject, $view, $data);
         Activity::emailInvoice($invitation);
     }
     if (!$invoice->isSent()) {
         $invoice->invoice_status_id = INVOICE_STATUS_SENT;
         $invoice->save();
     }
     \Event::fire('invoice.sent', $invoice);
 }
开发者ID:aleguisf,项目名称:fvdev1,代码行数:27,代码来源:ContactMailer.php


示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $videoItems = array(array("Breakfast Show!", "This is the breakfast show description."), array("BBC News"), array("BBC News 24"), array("Dragons Den"), array("Mock The Week!"), array("Some Other Show"), array("Soundbooth Sessions"), array("The LA1 Show"), array("The One Show"), array("Star Wars"), array("Sugar TV!"), array("The Incredibles"), array("University Challenge"), array("Countdown"), array("8 out of 10 Cats Does Countdown"), array("Jurassic Park"), array("Jurassic Park 2"), array("Shrek"), array("Shrek 2"), array("Shrek 3"), array("Mission Impossible"));
     foreach ($videoItems as $a) {
         $mediaItemVideo = new MediaItemVideo(array("is_live_recording" => rand(0, 1) ? true : false, "time_recorded" => Carbon::now()->subHour(), "description" => rand(0, 4) === 0 ? "A description that should override the general media item one." : null, "enabled" => rand(0, 1) ? true : false));
         $mediaItem = new MediaItem(array("name" => $a[0], "description" => count($a) >= 2 ? $a[1] : null, "enabled" => rand(0, 1) ? true : false, "scheduled_publish_time" => Carbon::now()));
         DB::transaction(function () use(&$mediaItem, &$mediaItemVideo) {
             $mediaItem->save();
             $mediaItem->videoItem()->save($mediaItemVideo);
         });
         $this->addLikes($mediaItem);
         $this->addComments($mediaItem);
     }
     //$mediaItemLiveStream = new MediaItemLiveStream(array(
     //	"enabled"	=>	true
     //));
     $mediaItem = new MediaItem(array("name" => "Lunchtime Show!", "description" => "This is the lunchtime show description.", "enabled" => true, "scheduled_publish_time" => Carbon::now()));
     DB::transaction(function () use(&$mediaItem, &$mediaItemLiveStream) {
         $mediaItem->save();
         //	$mediaItem->liveStreamItem()->save($mediaItemLiveStream);
     });
     $this->addLikes($mediaItem);
     $this->addComments($mediaItem);
     $this->command->info('Media items created!');
 }
开发者ID:joshhodgson,项目名称:Website,代码行数:30,代码来源:MediaItemSeeder.php


示例10: update

 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');
 }
开发者ID:heruujoko,项目名称:noapp,代码行数:32,代码来源:OssController.php


示例11: toText

 public function toText($txt)
 {
     $tab = explode('-', $txt);
     $date = Carbon::createFromTimeStamp($tab[0])->toDateString();
     $tab[1] == 'm' ? $day = 'matin' : ($day = 'après-midi');
     return $date . ' ' . $day;
 }
开发者ID:Byosphere,项目名称:BikeCityzen,代码行数:7,代码来源:Demijournee.php


示例12: fire

 public function fire()
 {
     $cacheName = $this->queueCacheName . $this->argument('aliasCacheCode');
     if (!Cache::has($cacheName)) {
         return;
     }
     $smallIds = Cache::pull($cacheName);
     $profiles = Profile::whereIn('small_id', $smallIds)->get();
     foreach ($profiles as $profile) {
         $steamAPI = new SteamAPI('alias');
         $steamAPI->setSmallId($profile->small_id);
         $steamAlias = $steamAPI->run();
         if ($steamAPI->error()) {
             $steamAlias = [];
         } else {
             usort($steamAlias, array('VacStatus\\Steam\\Steam', 'aliasSort'));
         }
         $profile->alias = json_encode($steamAlias);
         $profile->save();
         $cacheName = "profile_{$profile->small_id}}";
         if (!Cache::has($cachName)) {
             continue;
         }
         $profileCache = Cache::get($cacheName);
         $profileCache['alias'] = Steam::friendlyAlias($steamAlias);
         if (Cache::has($cacheName)) {
             Cache::forget($cacheName);
         }
         $expireTime = Carbon::now()->addMinutes(60);
         Cache::put($cacheName, $profileCache, $expireTime);
     }
 }
开发者ID:RobinJ1995,项目名称:VacStatus,代码行数:32,代码来源:UpdateMultiAlias.php


示例13: edit

 /**
  *  Редактирование сообщения
  */
 public function edit($id)
 {
     if (!User::check()) {
         App::abort(403);
     }
     if (!($guest = Guestbook::find_by_id($id))) {
         App::abort('default', 'Сообщение не найдено!');
     }
     if (!User::isAdmin() && $guest->user_id != User::getUser('id')) {
         App::abort('default', 'Редактирование невозможно, вы не автор данного сообщения!');
     }
     if (!User::isAdmin() && $guest->created_at < Carbon::now()->subMinutes(10)) {
         App::abort('default', 'Редактирование невозможно, прошло более 10 мин.');
     }
     if (Request::isMethod('post')) {
         $guest->token = Request::input('token', true);
         $guest->text = Request::input('text');
         if ($guest->save()) {
             App::setFlash('success', 'Сообщение успешно изменено!');
             App::redirect('/guestbook');
         } else {
             App::setFlash('danger', $guest->getErrors());
             App::setInput($_POST);
         }
     }
     App::view('guestbook.edit', compact('guest'));
 }
开发者ID:visavi,项目名称:rotorcms,代码行数:30,代码来源:GuestbookController.php


示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     $fecha = new Carbon();
     $fecha->setTimezone('America/Bogota');
     $data = array_add($data, 'fecha', $fecha::now());
     if (Auth::user()->avatar != null) {
         $imagen = "<img class='avatar circle' src='" . Auth::user()->avatar . "'/>";
     } else {
         $imagen = '  <i class="fa fa-2x fa-user"></i>';
     }
     $data = array_add($data, 'persona', Auth::user()->nombre . " de Residencia " . Residencias::find(Auth::user()->residencia_id)->nombre . $imagen);
     $data = array_add($data, 'user_id', Auth::user()->id);
     $noticia = Noticias::create($data);
     return $noticia;
 }
开发者ID:seedgabo,项目名称:condominio,代码行数:21,代码来源:NoticiasController.php


示例15: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $exclude = \App\EventCheckin::lists('sale_checkin_id');
     $ticketsales = \App\Sale::where('created_at', '>', \Carbon::parse('1/31/2016'))->whereNotIn('cart_id', $exclude)->with('cartsBySale', 'cartsBySale.product')->get();
     $checkedin = \App\Sale::where('created_at', '>', \Carbon::parse('1/31/2016'))->WhereIn('cart_id', $exclude)->with('cartsBySale', 'cartsBySale.product')->get();
     return view('orders.index', compact('ticketsales', 'checkedin'));
 }
开发者ID:NocturnalWare,项目名称:noctus,代码行数:12,代码来源:OrderManagerController.php


示例16: run

 public function run()
 {
     $now = Carbon::now();
     $permissions = [['name' => 'admin.adkats.bans.create', 'display_name' => 'Create New Bans', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.bans.edit', 'display_name' => 'Edit Bans', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.bans.view', 'display_name' => 'View Banlist', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.reports.edit', 'display_name' => 'Edit Admin Reports', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.reports.view', 'display_name' => 'View Admin Reports', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.settings.edit', 'display_name' => 'Edit AdKats Settings', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.special.edit', 'display_name' => 'Edit AdKats Special Players', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.special.view', 'display_name' => 'View AdKats Special Players', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.user.edit', 'display_name' => 'Edit AdKats Users', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.user.view', 'display_name' => 'View AdKats Users', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.roles.edit', 'display_name' => 'Edit AdKats Roles', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.adkats.roles.view', 'display_name' => 'View AdKats Roles', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.forgive', 'display_name' => 'Forgive Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.kick', 'display_name' => 'Kick Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.kickall', 'display_name' => 'Kick All Players', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.kill', 'display_name' => 'Kill Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.mute', 'display_name' => 'Mute Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.nuke', 'display_name' => 'Nuke Server', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.pban', 'display_name' => 'Perma Ban Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.punish', 'display_name' => 'Punish Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.say', 'display_name' => 'Say Message', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.tban', 'display_name' => 'Temp Ban Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.teamswitch', 'display_name' => 'Teamswitch Player', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.yell', 'display_name' => 'Yell Message', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.scoreboard.tell', 'display_name' => 'Tell Message (Sends both Say and Yell)', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.motd', 'display_name' => 'View Message of the Day', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.roles', 'display_name' => 'Manage Site Roles', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.settings.server', 'display_name' => 'Manage Server Settings', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.settings.site', 'display_name' => 'Manage Site Settings', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.users', 'display_name' => 'Manage Users', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.users.notify', 'display_name' => 'Receive emails on new user registration', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.site.system.logs', 'display_name' => 'View the application logs', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.player.special.add', 'display_name' => 'Add player to the special players table', 'created_at' => $now, 'updated_at' => $now], ['name' => 'admin.player.special.remove', 'display_name' => 'Remove player from the special players table', 'created_at' => $now, 'updated_at' => $now], ['name' => 'chatlogs', 'display_name' => 'View Chatlogs', 'created_at' => $now, 'updated_at' => $now], ['name' => 'player.infractions.forgive', 'display_name' => 'Issue Forgive Points', 'created_at' => $now, 'updated_at' => $now], ['name' => 'player.view.guids', 'display_name' => 'View Player GUIDS', 'created_at' => $now, 'updated_at' => $now], ['name' => 'player.view.ip', 'display_name' => 'View Player IP', 'created_at' => $now, 'updated_at' => $now]];
     Permission::insert($permissions);
     Role::find(1)->permissions()->attach(Permission::lists('id'));
 }
开发者ID:BP4U,项目名称:BFAdminCP,代码行数:7,代码来源:PermissionsTableSeeder.php


示例17: onLogin

 public function onLogin()
 {
     $account = Auth::user()->account;
     $account->last_login = Carbon::now()->toDateTimeString();
     $account->save();
     Event::fire('user.refresh');
 }
开发者ID:poseidonjm,项目名称:invoice-ninja,代码行数:7,代码来源:UserEventHandler.php


示例18: niceDateRange

 public function niceDateRange(Carbon $date1 = null, Carbon $date2 = null, $ordinalSuffixRequired = false)
 {
     $ordinalSuffix = "";
     $day1 = $date1->day;
     $day2 = $date2->day;
     $month1 = $date1->month;
     $month2 = $date2->month;
     //$ordinalSuffix = FormatMe::toOrdinalSuffix($day2);
     $restOfDate = $date2->format('F Y');
     $myDateString = "{$day1}-{$day2}" . $ordinalSuffix;
     // if months are not the same, display both months in range
     if ($month1 !== $month2) {
         return "{$day1} " . $date1->format('F') . " &ndash; " . "{$day2} " . $date2->format('F Y');
     }
     return $myDateString . ' ' . $restOfDate;
 }
开发者ID:wdmtech,项目名称:php-helpers,代码行数:16,代码来源:DateHelpers.php


示例19: run

 public function run()
 {
     Banner::truncate();
     Website::truncate();
     $user = User::create(array("username" => "danheyman", "name" => "Daniel Heyman", "email" => "[email protected]", "password" => "hello", "newsletter" => true, "admin_emails" => true, "membership" => "platinum", "paypal" => "", "membership_expires" => Carbon::now()->addMonth(), "referrals" => 0, "upline" => "", "cash" => 0, "credits" => 0, "credits_today" => 0, "views_total" => 0, "views_today" => 0, 'auto_assign' => 0, 'register_ip' => Request::getClientIp(), 'last_login' => Carbon::now()));
     for ($x = 0; $x < 20; $x++) {
         $website = new Website();
         $website->url = "http://listviral.com";
         $website->enabled = true;
         $website->credits = 10000;
         $website->views = 0;
         $website->days = array();
         $website->hours = array();
         $user->websites()->save($website);
         $banner = new Banner();
         $banner->banner = "http://brisksurf.com/banner.png";
         $banner->url = "http://brisksurf.com";
         $banner->enabled = true;
         $banner->credits = 10000;
         $banner->views = 0;
         $banner->days = array();
         $banner->hours = array();
         $user->banners()->save($banner);
     }
 }
开发者ID:danielheyman,项目名称:TechDimeProjects,代码行数:25,代码来源:SurfSeeder.php


示例20: ReportAffiliate

 public function ReportAffiliate($token)
 {
     $header = array(array('INSTITUCION DE PREVISION SOCIAL DEL PERIODISTA'), array('Carnet: ', '', ' Fecha Nacimiento: ', ' ', 'Edad: ', 'Fecha Ingreso: '), array('Nombre: '), array('Tiempo de jubilación Voluntaria: '), array('Tiempo de jubilación Obligatorio: '), array('Pago de Cuotas Sector Privado '), array(''), array('Año', 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'));
     $dues = $this->duesRepository->getModel()->where('affiliate_id', $affiliate->id)->orderBy('date_payment', 'ASC')->get();
     if (!$dues->isEmpty()) {
         //"01/01/1995"
         $old_year = Carbon::format($dues[0]->date_payment)->getFullYear();
         //1995
         $last_year = Carbon::format($dues[count($dues) - 1])->getFullYear();
         //2014
         for ($i = $old_year; $i <= $last_year; $i++) {
             $row[] = $i;
             for ($j = 1; $j <= 12; $j++) {
                 # code...
                 foreach ($dues as $key => $value) {
                     if ($value->date_payment == "01/" . $j . "/" . $i) {
                         array_push($row, $value->amount);
                     } else {
                         array_push($row, "");
                     }
                 }
             }
             array_push($header, $row);
         }
     }
     echo json_encode($header);
     die;
     /*   foreach ($dues as $due) {
              $duesYear =  $this->duesRepository->getModel()->where('date_payment',$affiliate->id)->where('affiliate_id',$affiliate->id)->orderBy('date_payment','ASC')->get();
              foreach(){
                  $header[] = ['Año','Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];
              }
              
          }*/
 }
开发者ID:asarmiento,项目名称:CPHon,代码行数:35,代码来源:ReportExcelController.php



注:本文中的Carbon类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Card类代码示例发布时间:2022-05-20
下一篇:
PHP Car类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap