diff --git a/app/Account.php b/app/Account.php index d4274d29bc1..6b044caad5b 100644 --- a/app/Account.php +++ b/app/Account.php @@ -3,7 +3,6 @@ namespace App; use DB; -use Carbon\Carbon; use Laravel\Cashier\Billable; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; @@ -46,7 +45,7 @@ public static function createDefault($first_name, $last_name, $email, $password) // create new account $account = new self; $account->api_key = str_random(30); - $account->created_at = Carbon::now(); + $account->created_at = now(); $account->save(); $account->populateDefaultFields($account); @@ -531,8 +530,8 @@ public function populateDefaultReminderRulesTable() */ public function getRemindersForMonth(int $month) { - $startOfMonth = \Carbon\Carbon::now()->addMonthsNoOverflow($month)->startOfMonth(); - $endInThreeMonths = \Carbon\Carbon::now()->addMonthsNoOverflow($month)->endOfMonth(); + $startOfMonth = now()->addMonthsNoOverflow($month)->startOfMonth(); + $endInThreeMonths = now()->addMonthsNoOverflow($month)->endOfMonth(); return auth()->user()->account->reminders() ->whereBetween('next_expected_date', [$startOfMonth, $endInThreeMonths]) diff --git a/app/Console/Commands/SendNotifications.php b/app/Console/Commands/SendNotifications.php index b642d3c8793..a703f54b42e 100644 --- a/app/Console/Commands/SendNotifications.php +++ b/app/Console/Commands/SendNotifications.php @@ -2,7 +2,6 @@ namespace App\Console\Commands; -use Carbon\Carbon; use App\Notification; use Illuminate\Console\Command; use App\Jobs\Notification\ScheduleNotification; @@ -30,7 +29,7 @@ class SendNotifications extends Command */ public function handle() { - $notifications = Notification::where('trigger_date', '<', Carbon::now()->addDays(2)) + $notifications = Notification::where('trigger_date', '<', now()->addDays(2)) ->orderBy('trigger_date', 'asc')->get(); foreach ($notifications as $notification) { diff --git a/app/Console/Commands/SendReminders.php b/app/Console/Commands/SendReminders.php index cb9dd016ffa..d9dfa3a426b 100644 --- a/app/Console/Commands/SendReminders.php +++ b/app/Console/Commands/SendReminders.php @@ -5,7 +5,6 @@ use App\User; use App\Account; use App\Reminder; -use Carbon\Carbon; use App\Jobs\SendReminderEmail; use Illuminate\Console\Command; use App\Jobs\SetNextReminderDate; @@ -37,7 +36,7 @@ public function handle() // Why 2? because in terms of timezone, we can have up to more than 24 hours // between two timezones and we need to take into accounts reminders // that are not in the same timezone. - $reminders = Reminder::where('next_expected_date', '<', Carbon::now()->addDays(2)) + $reminders = Reminder::where('next_expected_date', '<', now()->addDays(2)) ->orderBy('next_expected_date', 'asc')->get(); foreach ($reminders as $reminder) { diff --git a/app/Helpers/DateHelper.php b/app/Helpers/DateHelper.php index f6fdb5cf12d..8b7328b66e6 100644 --- a/app/Helpers/DateHelper.php +++ b/app/Helpers/DateHelper.php @@ -176,7 +176,7 @@ public static function addTimeAccordingToFrequencyType(Carbon $date, $frequency, */ public static function getMonthAndYear(int $month) { - $date = Date::now()->addMonthsNoOverflow($month); + $date = now()->addMonthsNoOverflow($month); $format = 'M Y'; return $date->format($format); @@ -193,10 +193,10 @@ public static function getMonthAndYear(int $month) public static function getNextTheoriticalBillingDate(String $interval) { if ($interval == 'monthly') { - return Date::now()->addMonth(); + return now()->addMonth(); } - return Date::now()->addYear(); + return now()->addYear(); } /** diff --git a/app/Http/Controllers/Api/ApiNoteController.php b/app/Http/Controllers/Api/ApiNoteController.php index 39b5e44f4b2..02c3ff76555 100644 --- a/app/Http/Controllers/Api/ApiNoteController.php +++ b/app/Http/Controllers/Api/ApiNoteController.php @@ -82,7 +82,7 @@ public function store(Request $request) } if ($request->get('is_favorited')) { - $note->favorited_at = \Carbon\Carbon::now(); + $note->favorited_at = now(); $note->save(); } @@ -134,7 +134,7 @@ public function update(Request $request, $noteId) } if ($request->get('is_favorited')) { - $note->favorited_at = \Carbon\Carbon::now(); + $note->favorited_at = now(); $note->save(); } else { $note->favorited_at = null; diff --git a/app/Http/Controllers/Contacts/NotesController.php b/app/Http/Controllers/Contacts/NotesController.php index c50fbb24105..51950295dfc 100644 --- a/app/Http/Controllers/Contacts/NotesController.php +++ b/app/Http/Controllers/Contacts/NotesController.php @@ -58,7 +58,7 @@ public function toggle(NoteToggleRequest $request, Contact $contact, Note $note) $note->is_favorited = false; } else { $note->is_favorited = true; - $note->favorited_at = \Carbon\Carbon::now(); + $note->favorited_at = now(); } $contact->logEvent('note', $note->id, 'update'); diff --git a/app/Http/Controllers/Contacts/TasksController.php b/app/Http/Controllers/Contacts/TasksController.php index c53cef63f28..9df7ae660d8 100644 --- a/app/Http/Controllers/Contacts/TasksController.php +++ b/app/Http/Controllers/Contacts/TasksController.php @@ -72,7 +72,7 @@ public function toggle(TaskToggleRequest $request, Contact $contact, Task $task) $task->completed = false; } else { $task->completed = true; - $task->completed_at = \Carbon\Carbon::now(); + $task->completed_at = now(); } $contact->logEvent('task', $task->id, 'update'); diff --git a/app/Http/Controllers/ContactsController.php b/app/Http/Controllers/ContactsController.php index fd55363bb3b..d8154f7d09b 100644 --- a/app/Http/Controllers/ContactsController.php +++ b/app/Http/Controllers/ContactsController.php @@ -184,7 +184,7 @@ public function show(Contact $contact) $reminders = $contact->getRemindersAboutRelatives(); - $contact->last_consulted_at = \Carbon\Carbon::now(auth()->user()->timezone); + $contact->last_consulted_at = now(auth()->user()->timezone); $contact->save(); return view('people.profile') @@ -201,9 +201,9 @@ public function show(Contact $contact) public function edit(Contact $contact) { $age = (string) (! is_null($contact->birthdate) ? $contact->birthdate->getAge() : 0); - $birthdate = ! is_null($contact->birthdate) ? $contact->birthdate->date->format('Y-m-d') : \Carbon\Carbon::now()->format('Y-m-d'); - $day = ! is_null($contact->birthdate) ? $contact->birthdate->date->day : \Carbon\Carbon::now()->day; - $month = ! is_null($contact->birthdate) ? $contact->birthdate->date->month : \Carbon\Carbon::now()->month; + $birthdate = ! is_null($contact->birthdate) ? $contact->birthdate->date->format('Y-m-d') : now()->format('Y-m-d'); + $day = ! is_null($contact->birthdate) ? $contact->birthdate->date->day : now()->day; + $month = ! is_null($contact->birthdate) ? $contact->birthdate->date->month : now()->month; return view('people.edit') ->withContact($contact) diff --git a/app/Http/Controllers/JournalController.php b/app/Http/Controllers/JournalController.php index b3605bc6383..6b3c637506d 100644 --- a/app/Http/Controllers/JournalController.php +++ b/app/Http/Controllers/JournalController.php @@ -83,7 +83,7 @@ public function get(JournalEntry $journalEntry) public function storeDay(DaysRequest $request) { $day = auth()->user()->account->days()->create([ - 'date' => \Carbon\Carbon::now(auth()->user()->timezone), + 'date' => now(auth()->user()->timezone), 'rate' => $request->get('rate'), ]); diff --git a/app/Jobs/AddContactFromVCard.php b/app/Jobs/AddContactFromVCard.php index 43096c3780c..a3d23628241 100644 --- a/app/Jobs/AddContactFromVCard.php +++ b/app/Jobs/AddContactFromVCard.php @@ -58,7 +58,7 @@ public function handle() protected function workInit($matchCount) { $this->matchCount = $matchCount; - $this->importJob->started_at = \Carbon\Carbon::now(); + $this->importJob->started_at = now(); return true; } @@ -83,7 +83,7 @@ protected function workEnd($numberOfContactsInTheFile, $skippedContacts, $import $this->importJob->contacts_found = $numberOfContactsInTheFile; $this->importJob->contacts_skipped = $skippedContacts; $this->importJob->contacts_imported = $importedContacts; - $this->importJob->ended_at = \Carbon\Carbon::now(); + $this->importJob->ended_at = now(); $this->importJob->save(); Storage::disk('public')->delete($this->importJob->filename); diff --git a/app/Jobs/ExportAccountAsSQL.php b/app/Jobs/ExportAccountAsSQL.php index c85c25ac36f..4a46dfa79a1 100644 --- a/app/Jobs/ExportAccountAsSQL.php +++ b/app/Jobs/ExportAccountAsSQL.php @@ -2,7 +2,6 @@ namespace App\Jobs; -use Carbon\Carbon; use Illuminate\Support\Facades\DB; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Storage; @@ -76,7 +75,7 @@ public function handle() $sql = '# ************************************************************ # '.$user->first_name.' '.$user->last_name." dump of data # {$this->file} -# Export date: ".Carbon::now().' +# Export date: ".now().' # ************************************************************ '.PHP_EOL; diff --git a/app/JournalEntry.php b/app/JournalEntry.php index ed00d1d2b54..c03cec3bf7b 100644 --- a/app/JournalEntry.php +++ b/app/JournalEntry.php @@ -49,7 +49,7 @@ public function account() public function add($resourceToLog) { $this->account_id = $resourceToLog->account_id; - $this->date = \Carbon\Carbon::now(); + $this->date = now(); $this->journalable_id = $resourceToLog->id; $this->journalable_type = get_class($resourceToLog); $this->save(); diff --git a/app/Reminder.php b/app/Reminder.php index a0137afc94a..99d685ba079 100644 --- a/app/Reminder.php +++ b/app/Reminder.php @@ -180,7 +180,7 @@ public function scheduleSingleNotification(int $numberOfDaysBefore) { $date = DateHelper::getDateMinusGivenNumberOfDays($this->next_expected_date, $numberOfDaysBefore); - if ($date->lte(Carbon::now())) { + if ($date->lte(now())) { return; } diff --git a/app/SpecialDate.php b/app/SpecialDate.php index 59e1a4e30a3..cfb23ff8c1d 100644 --- a/app/SpecialDate.php +++ b/app/SpecialDate.php @@ -168,7 +168,7 @@ public function getAge() return; } - return $this->date->diffInYears(Carbon::now()); + return $this->date->diffInYears(now()); } /** @@ -178,7 +178,7 @@ public function getAge() public function createFromAge(int $age) { $this->is_age_based = true; - $this->date = Carbon::now()->subYears($age)->month(1)->day(1); + $this->date = now()->subYears($age)->month(1)->day(1); $this->save(); return $this; @@ -197,7 +197,7 @@ public function createFromDate(int $year, int $month, int $day) if ($year != 0) { $date = Carbon::createFromDate($year, $month, $day); } else { - $date = Carbon::createFromDate(Carbon::now()->year, $month, $day); + $date = Carbon::createFromDate(now()->year, $month, $day); $this->is_year_unknown = true; } diff --git a/app/User.php b/app/User.php index 0bc0682793f..f128ac48d05 100644 --- a/app/User.php +++ b/app/User.php @@ -56,7 +56,7 @@ public static function createDefault($account_id, $first_name, $last_name, $emai $user->email = $email; $user->password = bcrypt($password); $user->timezone = config('app.timezone'); - $user->created_at = Carbon::now(); + $user->created_at = now(); $user->locale = \App::getLocale(); $user->save(); @@ -176,7 +176,7 @@ public function hasAlreadyRatedToday() { try { Day::where('account_id', $this->account_id) - ->where('date', \Carbon\Carbon::now($this->timezone)->format('Y-m-d')) + ->where('date', now($this->timezone)->format('Y-m-d')) ->firstOrFail(); } catch (ModelNotFoundException $e) { return false; @@ -224,7 +224,7 @@ public function shouldBeReminded(Carbon $date) { $dateOfReminder = $date->hour(0)->minute(0)->second(0)->toDateString(); - $currentDate = Carbon::now($this->timezone); + $currentDate = now($this->timezone); $currentHourOnUserTimezone = $currentDate->format('H:00'); $currentDateOnUserTimezone = $currentDate->hour(0)->minute(0)->second(0)->toDateString(); diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index fff74bf7453..88cfb29b24e 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -230,6 +230,6 @@ 'stripe_id' => $stripe_id, 'stripe_plan' => $stripe_plan ?: $faker->randomElement(['plan-1', 'plan-2', 'plan-3']), 'quantity' => 1, - 'created_at' => \Carbon\Carbon::now(), + 'created_at' => now(), ]; }); diff --git a/database/migrations/2017_11_10_181043_migrate_contacts_information.php b/database/migrations/2017_11_10_181043_migrate_contacts_information.php index fd6eadce2ea..f63f2a30a99 100644 --- a/database/migrations/2017_11_10_181043_migrate_contacts_information.php +++ b/database/migrations/2017_11_10_181043_migrate_contacts_information.php @@ -47,7 +47,7 @@ public function up() 'contact_id' => $contact->id, 'contact_field_type_id' => $emailId->id, 'data' => $contact->email, - 'created_at' => \Carbon\Carbon::now(), + 'created_at' => now(), ]); } @@ -57,7 +57,7 @@ public function up() 'contact_id' => $contact->id, 'contact_field_type_id' => $idPhoneNumber->id, 'data' => $contact->phone_number, - 'created_at' => \Carbon\Carbon::now(), + 'created_at' => now(), ]); } @@ -67,7 +67,7 @@ public function up() 'contact_id' => $contact->id, 'contact_field_type_id' => $idFacebook->id, 'data' => $contact->facebook_profile_url, - 'created_at' => \Carbon\Carbon::now(), + 'created_at' => now(), ]); } @@ -77,7 +77,7 @@ public function up() 'contact_id' => $contact->id, 'contact_field_type_id' => $idTwitter->id, 'data' => $contact->twitter_profile_url, - 'created_at' => \Carbon\Carbon::now(), + 'created_at' => now(), ]); } } diff --git a/database/migrations/2017_12_04_165421_move_ages_data.php b/database/migrations/2017_12_04_165421_move_ages_data.php index 4ef84320a56..e0cbb8149a4 100644 --- a/database/migrations/2017_12_04_165421_move_ages_data.php +++ b/database/migrations/2017_12_04_165421_move_ages_data.php @@ -26,7 +26,7 @@ public function up() 'is_age_based' => false, 'date' => $contact->deceased_date, 'reminder_id' => null, - 'created_at' => \Carbon\Carbon::now(), + 'created_at' => now(), ]); } @@ -43,7 +43,7 @@ public function up() 'is_age_based' => true, 'date' => $contact->birthdate, 'reminder_id' => $contact->birthday_reminder_id, - 'created_at' => \Carbon\Carbon::now(), + 'created_at' => now(), ]); break; @@ -54,7 +54,7 @@ public function up() 'is_age_based' => false, 'date' => $contact->birthdate, 'reminder_id' => $contact->birthday_reminder_id, - 'created_at' => \Carbon\Carbon::now(), + 'created_at' => now(), ]); break; @@ -68,7 +68,7 @@ public function up() 'is_age_based' => false, 'date' => $contact->first_met, 'reminder_id' => null, - 'created_at' => \Carbon\Carbon::now(), + 'created_at' => now(), ]); } diff --git a/database/seeds/ActivityTypesTableSeeder.php b/database/seeds/ActivityTypesTableSeeder.php index 2a5f9f8c850..e410e15fe12 100644 --- a/database/seeds/ActivityTypesTableSeeder.php +++ b/database/seeds/ActivityTypesTableSeeder.php @@ -1,6 +1,5 @@ insert([ 'key' => 'simple_activities', - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -27,8 +26,8 @@ public function run() 'location_type' => 'outside', 'icon' => 'hang_out', 'activity_type_group_id' => 1, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -36,8 +35,8 @@ public function run() 'location_type' => 'my_place', 'icon' => 'movie_home', 'activity_type_group_id' => 1, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -45,15 +44,15 @@ public function run() 'location_type' => 'my_place', 'icon' => 'talk_home', 'activity_type_group_id' => 1, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); // SPORT DB::table('activity_type_groups')->insert([ 'key' => 'sport', - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -61,15 +60,15 @@ public function run() 'location_type' => 'outside', 'icon' => 'sport', 'activity_type_group_id' => 2, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); // FOOD DB::table('activity_type_groups')->insert([ 'key' => 'food', - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -77,8 +76,8 @@ public function run() 'location_type' => 'his_place', 'icon' => 'ate_his_place', 'activity_type_group_id' => 3, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -86,8 +85,8 @@ public function run() 'location_type' => 'outside', 'icon' => 'bar', 'activity_type_group_id' => 3, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -95,8 +94,8 @@ public function run() 'location_type' => 'my_place', 'icon' => 'ate_home', 'activity_type_group_id' => 3, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -104,8 +103,8 @@ public function run() 'location_type' => 'outside', 'icon' => 'picknicked', 'activity_type_group_id' => 3, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -113,15 +112,15 @@ public function run() 'location_type' => 'outside', 'icon' => 'restaurant', 'activity_type_group_id' => 3, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); // CULTURAL DB::table('activity_type_groups')->insert([ 'key' => 'cultural_activities', - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -129,8 +128,8 @@ public function run() 'location_type' => 'outside', 'icon' => 'theater', 'activity_type_group_id' => 4, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -138,8 +137,8 @@ public function run() 'location_type' => 'outside', 'icon' => 'concert', 'activity_type_group_id' => 4, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -147,8 +146,8 @@ public function run() 'location_type' => 'outside', 'icon' => 'play', 'activity_type_group_id' => 4, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); DB::table('activity_types')->insert([ @@ -156,8 +155,8 @@ public function run() 'location_type' => 'outside', 'icon' => 'museum', 'activity_type_group_id' => 4, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => now(), + 'updated_at' => now(), ]); } } diff --git a/database/seeds/FakeContentTableSeeder.php b/database/seeds/FakeContentTableSeeder.php index f8f651ad303..35bce836807 100644 --- a/database/seeds/FakeContentTableSeeder.php +++ b/database/seeds/FakeContentTableSeeder.php @@ -397,7 +397,7 @@ public function populateEntries() 'date' => $date, 'journalable_id' => $entryId, 'journalable_type' => 'App\Entry', - 'created_at' => \Carbon\Carbon::now(), + 'created_at' => now(), ]); } } @@ -436,7 +436,7 @@ public function populateDayRatings() 'date' => $date, 'journalable_id' => $dayId, 'journalable_type' => 'App\Day', - 'created_at' => \Carbon\Carbon::now(), + 'created_at' => now(), ]); } } diff --git a/resources/views/activities/form.blade.php b/resources/views/activities/form.blade.php index 519882d851b..17c83de5ae0 100644 --- a/resources/views/activities/form.blade.php +++ b/resources/views/activities/form.blade.php @@ -39,9 +39,9 @@
@if ($errors->has('date_it_happened')) diff --git a/resources/views/emails/invitation/index.blade.php b/resources/views/emails/invitation/index.blade.php index 2dd6c25a1ce..a05e6397df2 100644 --- a/resources/views/emails/invitation/index.blade.php +++ b/resources/views/emails/invitation/index.blade.php @@ -436,7 +436,7 @@