当前位置: 首页>>代码示例>>PHP>>正文


PHP Carbon::now方法代码示例

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


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

示例1: sendInvoice

 public function sendInvoice(Invoice $invoice, $reminder = false)
 {
     $invoice->load('invitations', 'client.language', 'account');
     $entityType = $invoice->getEntityType();
     $client = $invoice->client;
     $account = $invoice->account;
     if ($invoice->trashed() || $client->trashed()) {
         return false;
     }
     $account->loadLocalizationSettings($client);
     if ($account->pdf_email_attachment) {
         $invoice->updateCachedPDF();
     }
     $view = 'invoice';
     $accountName = $invoice->account->getDisplayName();
     $emailTemplate = $invoice->account->getEmailTemplate($reminder ?: $entityType);
     $emailSubject = $invoice->account->getEmailSubject($reminder ?: $entityType);
     $this->initClosure($invoice);
     $response = false;
     $sent = false;
     foreach ($invoice->invitations as $invitation) {
         if (Auth::check()) {
             $user = Auth::user();
         } else {
             $user = $invitation->user;
             if ($invitation->user->trashed()) {
                 $user = $account->users()->orderBy('id')->first();
             }
         }
         if (!$user->email || !$user->confirmed) {
             continue;
         }
         if (!$invitation->contact->email || $invitation->contact->trashed()) {
             continue;
         }
         $invitation->sent_date = \Carbon::now()->toDateTimeString();
         $invitation->save();
         $variables = ['account' => $account, 'client' => $client, 'invitation' => $invitation, 'amount' => $invoice->getRequestedAmount()];
         $data['body'] = $this->processVariables($emailTemplate, $variables);
         $data['link'] = $invitation->getLink();
         $data['entityType'] = $entityType;
         $data['invoice_id'] = $invoice->id;
         $subject = $this->processVariables($emailSubject, $variables);
         $fromEmail = $user->email;
         $response = $this->sendTo($invitation->contact->email, $fromEmail, $accountName, $subject, $view, $data);
         if ($response === true) {
             $sent = true;
             Activity::emailInvoice($invitation);
         }
     }
     if ($sent === true) {
         if (!$invoice->isSent()) {
             $invoice->invoice_status_id = INVOICE_STATUS_SENT;
             $invoice->save();
         }
         $account->loadLocalizationSettings();
         Event::fire(new InvoiceSent($invoice));
     }
     return $response ?: trans('texts.email_error');
 }
开发者ID:juanmanavarro,项目名称:invoice-ninja,代码行数:60,代码来源:ContactMailer.php

示例2: indexAction

 public function indexAction()
 {
     $dateSelected = "";
     $sqlWithDate = "";
     if ($this->request->getPost()) {
         $dateSelected = $this->request->getPost('date');
         $sqlWithDate = " AND date_created = '{$dateSelected}'";
         $today = Carbon::now()->toDateString();
     }
     $hours = ['09' => ['hours' => '09', 'desc' => '09:00 - 10:00'], '10' => ['hours' => '10', 'desc' => '10:00 - 11:00'], '11' => ['hours' => '11', 'desc' => '11:00 - 12:00'], '12' => ['hours' => '12', 'desc' => '12:00 - 13:00'], '13' => ['hours' => '13', 'desc' => '13:00 - 14:00'], '14' => ['hours' => '14', 'desc' => '14:00 - 15:00'], '15' => ['hours' => '15', 'desc' => '15:00 - 16:00'], '16' => ['hours' => '16', 'desc' => '16:00 - 17:00'], '17' => ['hours' => '17', 'desc' => '17:00 - 18:00'], '18' => ['hours' => '18', 'desc' => '18:00 - 19:00'], '19' => ['hours' => '19', 'desc' => '19:00 - 20:00'], '20' => ['hours' => '20', 'desc' => '20:00 - 21:00'], '21' => ['hours' => '21', 'desc' => '21:00 - 22:00']];
     $stadium = [];
     $userID = "";
     for ($i = 1; $i <= 8; $i++) {
         foreach ($hours as $key => $value) {
             $order = Orders::findFirst("stadium = '{$i}' AND start_hour = '{$key}' {$sqlWithDate}");
             $link = "<a href=\"/process/add/{$i}/{$key}/{$this->session->get('user_id')}\" class=\"btn-xs btn-success\">Book Now</a>";
             $name = $link;
             if (isset($order->user_id)) {
                 $name = "<a class=\"btn-xs btn-default\">{$order->Userss->name}</a>";
                 if ($order->user_id == $this->session->get('user_id')) {
                     $name = "<a class=\"btn-xs btn-warning\">Yours</a>";
                 }
                 $userID = isset($order->user_id) ? $order->user_id : "";
             }
             if ($dateSelected < $today) {
                 $name = "<a class=\"btn-xs btn-danger\">Expired Book</a>";
             }
             $stadium[$key][$i] = ['desc' => $value['desc'], 'userId' => $userID, 'name' => $name];
         }
     }
     $this->view->setVar('data', $stadium);
     $this->view->setVar('dateSelected', $dateSelected . " (yy-mm-dd)");
 }
开发者ID:limferdi,项目名称:soccerStadiumReservation,代码行数:33,代码来源:DashboardController.php

示例3: showSinglestat

 public function showSinglestat($statID)
 {
     if (Auth::check()) {
         return Redirect::route('connect.connect');
     } else {
         try {
             $user = User::find(1);
             Auth::login($user);
             $currentMetrics = Calculator::currentMetrics();
             $metricValues = Metric::where('user', Auth::user()->id)->where('date', '<', Carbon::now())->orderBy('date', 'desc')->take(31)->get();
             foreach ($currentMetrics as $metricID => $statClassName) {
                 if ($metricID == $statID) {
                     $metricsArray = array();
                     foreach ($metricValues as $metric) {
                         $metricsArray[$metric->date] = $metric->{$metricID};
                     }
                     ksort($metricsArray);
                     $allMetrics[$metricID] = $metricsArray;
                 }
             }
             if (isset($currentMetrics[$statID])) {
                 return View::make('demo.single_stat', array('data' => $currentMetrics[$statID]['metricClass']::show($allMetrics[$statID], true), 'metricDetails' => $currentMetrics[$statID], Auth::logout()));
             }
             return Redirect::route('demo.dashboard')->with('error', 'Statistic does not exist.');
         } catch (Exception $e) {
             Auth::logout();
             Log::error($e);
             return Redirect::route('demo.dashboard')->with('error', 'Something went wrong, we will return shortly.');
         }
     }
 }
开发者ID:raschan,项目名称:fruit-dashboard,代码行数:31,代码来源:DemoController.php

示例4: sendEvent

 /**
  * sendEvent:
  * -------------------------------------------------- 
  * Dispatches an event based on the arguments.
  * @param (dict) (eventData) The event data
  *     (string) (en) [Req] Event Name.
  *     (array)  (md) Custom metadata
  * @return (boolean) true
  * --------------------------------------------------
  */
 public function sendEvent($eventData)
 {
     /* Build and send the request */
     self::$intercom->createEvent(array("event_name" => $eventData['en'], "created_at" => Carbon::now()->timestamp, "user_id" => Auth::user() ? Auth::user()->id : 0, "metadata" => array_key_exists('md', $eventData) ? $eventData['md'] : null));
     /* Return */
     return true;
 }
开发者ID:neraunzaran,项目名称:fruit-dashboard,代码行数:17,代码来源:IntercomTracker.php

示例5: storeResetPassword

 public function storeResetPassword(Request $request)
 {
     $id = Auth::user()->id;
     $user = User::findOrFail($id);
     //        $input = Request::all();
     //        $pass = $input['password_old'];
     //        $pass = bcrypt($pass);
     //dd($pass, $user->password);
     //dd($user->password);
     $this->validate($request, ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed']);
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = $this->passwords->reset($credentials, function ($user, $password) {
         $user->password = bcrypt($password);
         $user->save();
         $this->auth->login($user);
     });
     if ($pass == $user->password) {
         dd('норм');
         $input['created_at'] = Carbon::now();
         //        $input['updated_at'] = Carbon::now();
         $input['email'] = 'asd@asd.a';
         dd($input);
         PasswordReset::create($input);
     } else {
         dd('хлам');
         return redirect(trans('routes.locale') . '/home/{home}/edit');
     }
     return redirect(trans('routes.locale') . '/home/{home}/edit');
 }
开发者ID:sashacitylight,项目名称:sashasite,代码行数:29,代码来源:HomeController.php

示例6: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $sources = array(['hash' => 'AAAA', 'origin_type' => 'url', 'origin_url' => 'http://www.dataplatform.nl/dataset/6f219433-15c4-468b-91b4-8610710a987e/resource/0cb2d09a-b4b9-412a-bd98-c5934291107e/download/wijken-en-buurten-schiedam.geojson', 'origin_format' => null, 'origin_size' => null, 'name' => 'Neighborhoods', 'description' => 'Schiedam neighborhoods', 'web' => '', 'sync_status' => 'queued', 'sync_interval' => 'never', 'synced_at' => null, 'created_at' => Carbon::now()->format('Y-m-d H:i:s'), 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')], ['BBBB', 'origin_type' => 'url', 'origin_url' => 'http://civity.ckan.nl/dataset/a7bc454e-4551-4b11-a329-a58aeb79a583/resource/1bad33c0-1b8e-4bec-8b19-58b8c7e9b6dc/download/woningkartotheek.csv', 'origin_format' => null, 'origin_size' => null, 'name' => 'Cataster', 'description' => 'Schiedam cataster', 'web' => '', 'sync_status' => 'queued', 'sync_interval' => 'never', 'synced_at' => null, 'created_at' => Carbon::now()->format('Y-m-d H:i:s'), 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);
     // Uncomment the below to run the seeder
     DB::table('sources')->insert($sources);
     factory(App\Models\Source::class, 40)->create();
 }
开发者ID:jaumesala,项目名称:opendata-maps,代码行数:12,代码来源:SourcesTableSeeder.php

示例7: run

 public function run()
 {
     User::truncate();
     $user = User::create(array("username" => "danielheyman", "name" => "Daniel Heyman", "email" => "daniel.heyman@gmail.com", "password" => "hello", "newsletter" => true, "admin_emails" => true, "membership" => "platinum", "admin" => true, "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()));
     register_event($user, Request::getClientIp(), "http://activation.link");
     login_event($user);
 }
开发者ID:danielheyman,项目名称:TechDimeProjects,代码行数:7,代码来源:UserSeeder.php

示例8: 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

示例9: fire

 public function fire()
 {
     $rechecks = $this->listUser->where('recheck', '<', \Carbon::now())->get();
     foreach ($rechecks as $recheck) {
         \App::make('ListManager')->process(false, $recheck->list_id, $recheck->user_id);
     }
 }
开发者ID:danielheyman,项目名称:TechDimeProjects,代码行数:7,代码来源:Recheck.php

示例10: 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

示例11: 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

示例12: run

 public function run()
 {
     Banner::truncate();
     Website::truncate();
     $user = User::create(array("username" => "danheyman", "name" => "Daniel Heyman", "email" => "heymandan@gmail.com", "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

示例13: run

 public function run()
 {
     DB::table('landmarks')->delete();
     $dt = Carbon::now();
     $dateNow = $dt->toDateTimeString();
     DB::table('landmarks')->insert(array(array('name' => 'ufo 1', 'desc' => 'Description of ufo view in Oviedo, spain.', 'location' => 'Oviedo', 'link' => 'http://exoarchive.com/ufo1', 'image' => 'http://cdn2-b.examiner.com/sites/default/files/styles/image_content_width/hash/b9/b2/1360764616_6383_UFO.jpg', 'latitude' => '43.361915', 'longitude' => '5.849389', 'mapId' => '1', 'viewDate' => $dateNow, 'created_at' => $dateNow, 'updated_at' => $dateNow), array('name' => 'ufo 2', 'desc' => 'Description of ufo view in Barcelona, spain.', 'location' => 'Batcelona', 'link' => 'http://exoarchive.com/ufo2', 'image' => 'http://cdn2-b.examiner.com/sites/default/files/styles/image_content_width/hash/b9/b2/1360764616_6383_UFO.jpg', 'latitude' => '41.385064', 'longitude' => '2.173403', 'mapId' => '1', 'viewDate' => $dateNow, 'created_at' => $dateNow, 'updated_at' => $dateNow), array('name' => 'ufo 3', 'desc' => 'Description of ufo view in Madrid, spain.', 'location' => 'Madrid', 'link' => 'http://exoarchive.com/ufo3', 'image' => 'http://cdn2-b.examiner.com/sites/default/files/styles/image_content_width/hash/b9/b2/1360764616_6383_UFO.jpg', 'latitude' => '40.416775', 'longitude' => '-3.70379', 'mapId' => '1', 'viewDate' => $dateNow, 'created_at' => $dateNow, 'updated_at' => $dateNow), array('name' => 'ufo 4', 'desc' => 'Description of ufo view in Alicante, spain.', 'location' => 'Alicante', 'link' => 'http://exoarchive.com/ufo4', 'image' => 'http://cdn2-b.examiner.com/sites/default/files/styles/image_content_width/hash/b9/b2/1360764616_6383_UFO.jpg', 'latitude' => '40.970104', 'longitude' => '-5.66354', 'mapId' => '1', 'viewDate' => $dateNow, 'created_at' => $dateNow, 'updated_at' => $dateNow)));
 }
开发者ID:Aranjedeath,项目名称:l4-starter,代码行数:7,代码来源:LandmarksTableSeeder.php

示例14: mongoTime

 public function mongoTime($time = false)
 {
     if (!$time) {
         $time = \Carbon::now();
     }
     return new \MongoDate($time->getTimestamp());
 }
开发者ID:danielheyman,项目名称:TechDimeProjects,代码行数:7,代码来源:ActionManager.php

示例15: validate

 function validate()
 {
     if (!Session::has('vatsimauth')) {
         throw new AuthException('Session does not exist');
     }
     $SSO = new SSO(Config::get('vatsim.base'), Config::get('vatsim.key'), Config::get('vatsim.secret'), Config::get('vatsim.method'), Config::get('vatsim.cert'));
     $session = Session::get('vatsimauth');
     if (Input::get('oauth_token') !== $session['key']) {
         throw new AuthException('Returned token does not match');
         return;
     }
     if (!Input::has('oauth_verifier')) {
         throw new AuthException('No verification code provided');
     }
     $user = $SSO->checkLogin($session['key'], $session['secret'], Input::get('oauth_verifier'));
     if ($user) {
         Session::forget('vatsimauth');
         $authUser = User::find($user->user->id);
         if (is_null($authUser)) {
             $authUser = new User();
             $authUser->vatsim_id = $user->user->id;
             $authUser->name = trim($user->user->name_first . ' ' . $user->user->name_last);
         }
         $authUser->last_login = Carbon::now();
         $authUser->save();
         Auth::login($authUser);
         Messages::success('Welcome on board, <strong>' . $authUser->name . '</strong>!');
         return Redirect::intended('/');
     } else {
         $error = $SSO->error();
         throw new AuthException($error['message']);
     }
 }
开发者ID:T-SummerStudent,项目名称:new,代码行数:33,代码来源:AuthController.php


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