/** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * * @return void */ protected function schedule(Schedule $schedule) { $schedule->command('inspire')->hourly(); // 进入维护模式 $schedule->command('down')->evenInMaintenanceMode()->dailyAt('23:00'); //->when(function () {return true;});// // 更新用户等级 $schedule->call(function () { $registrations = Registration::where('state', 0)->where(function ($query) { $query->where('registration_date', Carbon::yesterday()->toDateString()); })->get(); foreach ($registrations as $registration) { $user = $registration->user; $user->credit_level -= 1; $user->save(); } })->evenInMaintenanceMode()->daily(); // // 重置rest_num $schedule->call(function () { $doctor_schedules = DocSchedule::where('state', 0)->where(function ($query) { $week = [1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday', 7 => 'sunday']; $query->where('doctoring_date', $week[Carbon::today()->dayOfWeek]); })->get(); foreach ($doctor_schedules as $doctor_schedule) { $doctor_schedule->rest_num = $doctor_schedule->total_num; $doctor_schedule->save(); } })->evenInMaintenanceMode()->dailyAt('3:00'); // // 离开维护模式 $schedule->command('up')->evenInMaintenanceMode()->dailyAt('7:00'); // }
/** * @test */ public function it_checks_the_fixed_budget_attributes_are_correct_when_expense_is_on_same_day_as_starting_date() { $this->logInUser(); //Create expense and income transactions with budget id of 2 $this->createTransactionsOnStartingDate(); $response = $this->apiCall('GET', 'api/budgets?fixed=true&includeExtra=true'); $content = json_decode($response->getContent(), true); $budget = $content[0]; $this->checkBudgetKeysExist($budget, true); // Check if the values are correct according to our seeders!! $this->assertEquals("http://localhost/api/budgets/2", $budget['path']); $this->assertEquals("business", $budget['name']); $this->assertEquals(100, $budget['amount']); $this->assertEquals(null, $budget['calculatedAmount']); $this->assertEquals('fixed', $budget['type']); $this->assertEquals(Carbon::today()->subMonths(8)->format('d/m/y'), $budget['formattedStartingDate']); $this->assertEquals(-270, $budget['spent']); $this->assertEquals(305, $budget['received']); $this->assertEquals(-240, $budget['spentOnOrAfterStartingDate']); $this->assertEquals(-30, $budget['spentBeforeStartingDate']); $this->assertEquals(205, $budget['receivedOnOrAfterStartingDate']); $this->assertEquals(9, $budget['cumulativeMonthNumber']); $this->assertEquals(900, $budget['cumulative']); $this->assertEquals(865, $budget['remaining']); $this->assertEquals(8, $budget['transactionsCount']); $this->assertResponseOk(); }
public function search(Request $request) { $rfc = $request->rfc; $tipo = $request->tipo_id; $today = Carbon::today(); $today = $today->year . '-' . $today->month . '-' . $today->day; $paciente = Paciente::where('rfc', '=', $rfc)->where('tipo_id', '=', $tipo)->first(); $tipo = Tipo::find($tipo); if (isset($paciente)) { if ($paciente->count() > 1) { $citas = Cita::orderBy('fecha', 'desc')->where('paciente_id', '=', $paciente->id)->take(5)->get(); $citas->each(function ($citas) { $citas->paciente->tipo; $citas->medico->especialidad; $citas->fecha = fecha_dmy($citas->fecha); }); if ($citas->count() >= 1) { return Response::json($citas, 200); } else { $response = array('error' => 'true'); return Response::json('No se encontro citas con paciente RFC: ' . $rfc . ' - ' . $tipo->code, 500); } } } else { $response = array('error' => 'true'); return Response::json('No se encontro Paciente con RFC: ' . $rfc . ' - ' . $tipo->code, 500); } }
/** * Display a listing of the resource. * * @param string $customerId * * @return \Illuminate\Http\JsonResponse */ public function index($customerId) { //TODO Create dynamic values $findDataRequest = array('creation[lte]' => Carbon::today()->addDay(1)->toDateString(), 'offset' => 0, 'limit' => 100); try { $openpayReference = OpenpayReferenceModel::where('user_id', $customerId)->first(); if ($openpayReference == null) { return response()->json(array("response" => "error", "class" => "CustomerControllerError", "error" => array("code" => 101, "message" => "Customer doesn't exist"))); } $customer = $this->openpay->customers->get($openpayReference->openpay_id); $cardList = $customer->cards->getList($findDataRequest); $data = array(); //TODO Create dynamic values foreach ($cardList as $card) { $cardData = array(); $cardData["card_number"] = $card->card_number; $cardData["id"] = $card->id; $cardData["brand"] = $card->brand; array_push($data, $cardData); } return response()->json(array("response" => "result", "result" => $data)); } catch (\OpenpayApiError $e) { return response()->json(array("response" => "error", "class" => get_class($e), "error" => array("code" => $e->getErrorCode(), "message" => $e->getMessage(), "http_code" => $e->getHttpCode(), "category" => $e->getCategory()))); } catch (\Exception $e) { return response()->json(array("response" => "error", "class" => get_class($e), "error" => array("code" => $e->getCode(), "message" => $e->getMessage()))); } }
public function showUM() { $tgl = Carbon::today(); $thn = $tgl->year . $tgl->year + 1; $tagihans = TagihanPendaftar::where('ThnAkademik', $thn)->get(); return view('tagihan.um', ['tagihans' => $tagihans]); }
/** * Show the application dashboard. * * @return Response */ public function index(ReferenceServiceInterface $referenceService) { $defaultPickupDate = Carbon::today()->addDay(3)->toDateString(); $defaultReturnDate = Carbon::today()->addDay(5)->toDateString(); $marquee = $referenceService->getMarquee(); return view('sites.index', compact('defaultPickupDate', 'defaultReturnDate', 'marquee')); }
/** * @return string */ protected function getKey() { $today = Carbon::today(); $month_prefix = $today->format('Ym'); $customer_prefix = $this->customer->id; return 'ohmate-invitation-count-' . $customer_prefix . '-' . $month_prefix; }
/** * Whether conference is currently accepted talk proposals * * @return bool */ public function isCurrentlyAcceptingProposals() { if (!$this->hasAnnouncedCallForProposals()) { return false; } return Carbon::today()->between($this->getAttribute('cfp_starts_at'), $this->getAttribute('cfp_ends_at')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $currentdate = Carbon::today(); $affiliationActives = \App\Affiliation::orderBy('created_at', 'DEC')->where('finalization', '>=', $currentdate)->get(); $affiliationInactives = \App\Affiliation::orderBy('created_at', 'DEC')->where('finalization', '<', $currentdate)->get(); return view('affiliation.index')->with('affiliationActives', $affiliationActives)->with("affiliationInactives", $affiliationInactives); }
/** * Execute the console command. * * @return mixed */ public function handle() { //check if have entry for today //check if locked //if good kaliwali //else populate with zeroes //then lock if (Attendance::latest('att_date')->first()->att_date != Carbon::today()) { $currentDate = new Attendance(); $currentDate->att_date = Carbon::today(); $holiday = 0; if (Carbon::today()->format('l') == 'Friday' || Holiday::where('holidate', Carbon::today())->first() != null) { $holiday = 1; } $currentDate->holiday = $holiday; $currentDate->save(); } foreach (Site::all() as $site) { foreach ($site->labor as $labor) { if ($labor->attendance()->where('att_date', Carbon::today()->format('Y-m-d G:i:s'))->first() != null) { $labor->attendance()->where('att_date', Carbon::today()->format('Y-m-d G:i:s'))->first()->pivot->update(['locked' => 'true']); } else { Attendance::latest('att_date')->first()->labor()->attach($labor->id); $att = $labor->attendance()->where('att_date', Carbon::today()->format('Y-m-d G:i:s'))->first(); $att->pivot->locked = 'true'; $att->pivot->attended = $att->holiday == 1 ? 1 : 0; $att->pivot->ot = 0; $att->pivot->bot = 0; $att->pivot->site = $labor->site->code; $att->pivot->save(); } } } }
public function store(AdminPlacementCreateRequest $request) { $placement = Ad_Web::create($request->all()); $placement->created_at = Carbon::today()->addDay(1); $ad = Ad::find($placement->ad_id); if ($ad->tipo == 'pequeño') { $placement->script = "<iframe src='" . url('imp/' . $placement->id . '-smwl') . "' scrolling='no' frameborder='0' width='300' height='250'></iframe>"; $placement->save(); } elseif ($ad->tipo == 'mediano') { $placement->script = "<iframe src='" . url('imp/' . $placement->id . '-lgrc') . "' scrolling='no' frameborder='0' width='728' height='90'></iframe>"; $placement->save(); } elseif ($ad->tipo == 'popup') { $placement->script = "<script src='" . url('imp/' . $placement->id . '-pobd') . "'></script>"; $placement->save(); } elseif ($ad->tipo == 'vertical') { $placement->script = "<iframe src='" . url('imp/' . $placement->id . '-vlty') . "' scrolling='no' frameborder='0' width='160' height='600'></iframe>"; $placement->save(); } else { $placement->script = "<iframe src='" . url('imp/' . $placement->id) . " scrolling='no' frameborder='0''></iframe>"; $placement->save(); } if ($placement->save()) { notify()->flash('Placement created correctly', 'success', ['timer' => 3000, 'text' => '']); } else { notify()->flash('There was a problem creating the placement', 'error', ['timer' => 3000, 'text' => '']); } return redirect()->to("admin/placement"); }
/** * @param $startDate */ protected function setStartDate(Carbon $startDate = null) { if (is_null($startDate)) { $startDate = Carbon::today(); } $this->startDate = $startDate; }
public function ajaxRateInfo(Request $request) { /*$rate_id = $request->rate_id; $rate = Rate::where('id', '=', $rate_id)->get(); return Response::json($rate);*/ $rate_id = $request->rate_id; $rate = Rate::where('id', '=', $rate_id)->firstOrFail(); $price = number_format($rate->price, 2); if ($rate->period == 'day') { $expirationDate = Carbon::today()->addDays($rate->period_count)->format('F d\\, Y'); } else { if ($rate->period == 'month') { $expirationDate = Carbon::today()->addMonths($rate->period_count)->subDay()->format('F d\\, Y'); } else { if ($rate->period == 'year') { $expirationDate = Carbon::today()->addYears($rate->period_count)->subDay()->format('F d\\, Y'); } } } /*if($rate_id == 2) { $expirationDate = Carbon::today()->addMonth()->format('F d\\, Y'); } else if($rate_id == 6) { $expirationDate = Carbon::today()->addYear()->subDay()->format('F d\\, Y'); }*/ return Response::json(['price' => $price, 'expirationDate' => $expirationDate]); }
/** * Function for storing a new blog article. * * @param $request * @param ArticleRequest $request * @return Redirect */ public function store(ArticleRequest $request) { if ($request->has('slug')) { $request['slug'] = str_slug($request['slug'], "_"); } else { $request['slug'] = str_slug($request['title'], "_"); } $today = Carbon::today()->format('Y') . '/' . Carbon::today()->format('M') . '/' . Carbon::today()->format('d'); $uploadPath = base_path() . '/public/img/uploads/' . $today; $article = Article::create($request->all()); // TODO: Refine into two seperate actions // if (!empty($request['cover-image']) || !empty($request['cover-image'])) { $SmallImageName = '/img/uploads/' . $today . '/' . $request['slug'] . '_sml' . '.' . $request->file('listing-image')->getClientOriginalExtension(); $coverImageName = '/img/uploads/' . $today . '/' . $request['slug'] . '_cover' . '.' . $request->file('cover-image')->getClientOriginalExtension(); $article['imgfull'] = $coverImageName; $article['imgsml'] = $SmallImageName; } $article['page_code'] = str_random(16); $article['author'] = Auth::user()->id; $article['category'] = $request['category']; // TODO:: Preform a check to see if this Category Exists // $article['published'] = Carbon::parse($request['published']); // TODO:: Add a time to publish field // $article->save(); if (!empty($request['cover-image']) || !empty($request['cover-image'])) { $request->file('listing-image')->move($uploadPath, $SmallImageName); $request->file('cover-image')->move($uploadPath, $coverImageName); } return redirect('blog/' . $request->slug); }
/** * @test */ public function it_checks_the_flex_budget_attributes_are_correct_when_including_the_extra_budget_attributes() { $this->logInUser(); $response = $this->apiCall('GET', 'api/budgets?flex=true&includeExtra=true'); $content = json_decode($response->getContent(), true); // dd($content); $budget = $content[0]; // dd($budget); $this->checkBudgetKeysExist($budget, true); // Check if the values are correct according to our seeders!! $this->assertEquals("http://localhost/api/budgets/4", $budget['path']); $this->assertEquals("busking", $budget['name']); $this->assertEquals(10, $budget['amount']); $this->assertEquals(20, $budget['calculatedAmount']); $this->assertEquals('flex', $budget['type']); $this->assertEquals(Carbon::today()->subMonths(8)->format('d/m/y'), $budget['formattedStartingDate']); $this->assertEquals(-35, $budget['spent']); $this->assertEquals(1500, $budget['received']); $this->assertEquals(-15, $budget['spentBeforeStartingDate']); $this->assertEquals(-20, $budget['spentOnOrAfterStartingDate']); $this->assertEquals(1000, $budget['receivedOnOrAfterStartingDate']); $this->assertEquals(9, $budget['cumulativeMonthNumber']); $this->assertEquals(null, $budget['cumulative']); $this->assertEquals(1000, $budget['remaining']); $this->assertEquals(6, $budget['transactionsCount']); $this->assertResponseOk(); }
public function getDate($next_series_starts) { $today = Carbon::today(); $diff_in_days = $today->diffInDays($this->starts_at, false); // Next series has already started, just show the date for this series if (!is_null($next_series_starts) and $next_series_starts->gt($today)) { return $this->starts_at->format('M, Y'); } // Series started before today if ($diff_in_days < 0) { return 'Current series'; } // Series started today if ($diff_in_days === 0) { return 'Begins today!'; } // 6 days away (it's Sunday before it starts (on Saturday) if ($diff_in_days === 6) { return 'Begins in 1 week'; } // More than a week away if ($diff_in_days >= 7) { return 'Begins in ' . $this->starts_at->diffInWeeks($today) . ' week' . ($this->starts_at->diffInWeeks($today) > 1 ? 's' : ''); } return 'Begins this weekend'; }
/** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { $schedule->call(function () { $trip_ids = Trip::where('departure_date', Carbon::today())->lists('id')->toArray(); Booking::where('status', 'reserved')->whereIn('trip_id', $trip_ids)->delete(); })->everyMinute(); }
/** * Show the application dashboard. * * @return \Illuminate\Http\Response */ public function index() { $today = Carbon::today(); $tomorrow = Carbon::tomorrow(); $tomorrowbookinguser = Booking::where('bookingdate', '=', $tomorrow)->get(); $dt = Carbon::now(); $year = $dt->year; $month = $dt->month; $currentmonthbreakfast = Booking::where('user_id', Auth::user()->id)->whereMonth('bookingdate', '=', $month)->whereYear('bookingdate', '=', $year)->where('breakfast', '=', 'on')->count(); $currentmonthlunch = Booking::where('user_id', Auth::user()->id)->whereMonth('bookingdate', '=', $month)->whereMonth('bookingdate', '=', $month)->whereYear('bookingdate', '=', $year)->where('lunch', '=', 'on')->count(); $currentmonthdinner = Booking::where('user_id', Auth::user()->id)->whereMonth('bookingdate', '=', $month)->whereMonth('bookingdate', '=', $month)->whereYear('bookingdate', '=', $year)->where('dinner', '=', 'on')->count(); $totalbooking = $currentmonthbreakfast + $currentmonthlunch + $currentmonthdinner; $price = Account::whereMonth('accountdate', '=', date('m'))->where('user_id', Auth::user()->id)->sum('amount'); $todaydayshop = Shop::where('shopdate', $today)->get(); $tomorrowshop = Shop::where('shopdate', $tomorrow)->get(); $bookings = Booking::where('bookingdate', '=', $today)->get(); $breakfast = Booking::where('bookingdate', '=', $today)->where('breakfast', '=', 'on')->count(); $lunch = Booking::where('bookingdate', '=', $today)->where('lunch', '=', 'on')->count(); $dinner = Booking::where('bookingdate', '=', $today)->where('dinner', '=', 'on')->count(); $t_breakfast = Booking::where('bookingdate', '=', $tomorrow)->where('breakfast', '=', 'on')->count(); $t_lunch = Booking::where('bookingdate', '=', $tomorrow)->where('lunch', '=', 'on')->count(); $t_dinner = Booking::where('bookingdate', '=', $tomorrow)->where('dinner', '=', 'on')->count(); $useraccounts = DB::table('useraccounts')->where('user_id', Auth::user()->id)->select('user_id', DB::raw("SUM(foodamount) AS t_foodamount"), DB::raw("SUM(houserent) AS t_houserent"), DB::raw("SUM(internetbill) AS t_internetbill"), DB::raw("SUM(utlitybill) AS t_utlitybill"), DB::raw("SUM(buabill) AS t_buabill"), DB::raw("SUM(pay) AS t_pay"))->get(); foreach ($useraccounts as $account) { $amount = $account->t_foodamount + $account->t_houserent + $account->t_internetbill + $account->t_utlitybill + $account->t_buabill; $balance = $amount - $account->t_pay; } return view('home', ['bookings' => $bookings, 'breakfast' => $breakfast, 'lunch' => $lunch, 'dinner' => $dinner, 't_breakfast' => $t_breakfast, 't_lunch' => $t_lunch, 't_dinner' => $t_dinner, 'tomorrow' => $tomorrow, 'todaydayshop' => $todaydayshop, 'tomorrowshop' => $tomorrowshop, 'tomorrowbookinguser' => $tomorrowbookinguser, 'balance' => $balance, 'currentmonthbreakfast' => $currentmonthbreakfast, 'currentmonthlunch' => $currentmonthlunch, 'currentmonthdinner' => $currentmonthdinner, 'totalbooking' => $totalbooking, 'price' => $price]); }
public function handle($request, Closure $next) { $today = Carbon::now('Asia/Manila'); $report_date = Config::find(1); // Send a report if today is not set to our config table if ($report_date->report_date->day != $today->day || $report_date->report_date->month != $today->month || $report_date->report_date->year != $today->year) { $report_date->report_date = $today; $report_date->save(); $deadline_names = []; $i = new \App\Info(); foreach (\App\Info::all() as $info) { $deadline = $i->isDeadLineToday($info->dead_line); if ($deadline == 'deadline' && $info->claim_status != 'approved') { $deadline_names[$info->name] = $info; } } $data = array('data' => $deadline_names); \Log::info('Sending mail....'); \Mail::send('email.email', $data, function ($message) { $message->from('*****@*****.**', 'GIBX Internal System'); $date = \Carbon\Carbon::today('Asia/Manila')->format('d/m/Y'); $recipients = ['*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**']; $message->to($recipients)->subject('GIBX Claims System Daily Report ' . $date); }); // TODO: Send an email for reporting here... } return $next($request); }
public function test_renderContent_returns_twig_parsed_content() { $campaign2 = Campaign::create(['name' => 'Test split2', 'file_name' => 'test-split2.htm', 'file_type' => 'partial', 'start_at' => Carbon::today(), 'end_at' => Carbon::tomorrow(), 'version_a_content' => 'Foo', 'version_b_content' => 'Bar']); $campaign1 = Campaign::create(['name' => 'Test split1', 'file_name' => 'test-split1.htm', 'file_type' => 'partial', 'start_at' => Carbon::today(), 'end_at' => Carbon::tomorrow(), 'version_a_content' => 'Hello {{ split(' . $campaign2->id . ') }}', 'version_b_content' => 'World {{ split(' . $campaign2->id . ') }}']); $content = CmsHelper::renderContent($campaign1->id); $this->assertTrue(in_array($content, ['Hello Foo', 'Hello Bar', 'World Foo', 'World Bar'])); }
/** * Execute the console command. * * @return mixed */ public function handle() { $date = Carbon::today(); $date1 = substr($date->addDays(1), 0, 10); $date2 = substr($date->addDays(1), 0, 10); $date3 = substr(Carbon::today()->addDays(40), 0, 10); $date0 = substr(Carbon::today(), 0, 10); $id[0] = DB::table('email_articles')->where('post_date', $date0)->value('article_id'); $id[1] = DB::table('email_articles')->where('post_date', '=', $date1)->value('article_id'); $id[2] = DB::table('email_articles')->where('post_date', '=', $date2)->value('article_id'); $id[3] = DB::table('email_articles')->where('post_date', '=', $date3)->value('article_id'); $events = DB::select(DB::raw("SELECT * FROM events WHERE article_id >= '{$id['0']}' AND article_id < '{$id['3']}' AND type = 'event' LIMIT 3")); $collegeNews = DB::select(DB::raw("SELECT * FROM events WHERE article_id <= '{$id['0']}'")); $icons = DB::table('icons')->get(); $menu1 = DB::table('dining_hall_food')->where('store_id', '4')->where('meal', 'breakfast')->where('article_id', $id[0])->get(); $menu2 = DB::table('dining_hall_food')->where('store_id', '4')->where('meal', 'lunch')->where('article_id', $id[0])->get(); $menu3 = DB::table('dining_hall_food')->where('store_id', '4')->where('meal', 'dinner')->where('article_id', $id[0])->get(); $weather = DB::table('weather')->where('article_id', $id[0])->get(); $weather2 = DB::table('weather')->where('article_id', $id[1])->get(); $weather3 = DB::table('weather')->where('article_id', $id[2])->get(); $ga = DB::table('posts')->where('article_id', '<=', $id[0])->where('source', 'The Golden Antlers')->take(2)->get(); $forum = DB::table('posts')->where('article_id', '<=', $id[0])->where('source', 'The Forum')->take(2)->get(); $independent = DB::table('posts')->where('article_id', '<=', $id[0])->where('source', 'Claremont Independent')->take(2)->get(); $buzz = DB::table('posts')->where('article_id', '<=', $id[0])->where('source', 'BuzzFeed')->take(2)->get(); $pp = DB::table('sports')->where('college', 'PP')->where('article_id', '<=', $id[0] + 40)->take(3)->get(); $cms = DB::table('sports')->where('college', 'CMS')->where('article_id', '<=', $id[0] + 32)->get(); $ath = DB::select(DB::raw("SELECT * FROM ath WHERE article_id > 387")); $athToday = DB::table('ath')->where('article_id', 387)->get(); $gif = DB::table('gifs')->where('article_id', $id[0])->get(); $insta = DB::table('instagrams')->where('article_id', $id[0])->get(); Mail::send('email3', ['id' => $id, 'date' => Carbon::today(), 'insta' => $insta, 'futureAth' => $ath, 'todayAth' => $athToday, 'gif' => $gif, 'menu1' => $menu1, 'menu2' => $menu2, 'menu3' => $menu3, 'icons' => $icons, 'collegeNews' => $collegeNews, 'events' => $events, 'weather' => $weather, 'weather2' => $weather2, 'weather3' => $weather3, 'ga' => $ga, 'independent' => $independent, 'forum' => $forum, 'buzz' => $buzz, 'pp' => $pp, 'cms' => $cms], function ($message) { $message->to('*****@*****.**', 'Kevin')->subject('Yoooo!'); }); echo "Sent!"; }
protected function setUp() { $client = Mockery::mock(stdClass::class . ", " . ClientInterface::class); $auth = mock_auth(); $this->trakt = new Trakt($auth, $client); $this->today = Carbon::today(new DateTimeZone("Europe/Amsterdam")); }
/** * Render yearly panel with navigation and chart * @param string $envelopeId Envelope primary key * @param string|null $date Date within the year to consider (default to current year) * @return Illuminate\View\View|\Illuminate\Contracts\View\Factory View */ public function getYearly($envelopeId, $date = null) { $envelope = Auth::user()->envelopes()->findOrFail($envelopeId); $date = is_null($date) ? Carbon::today() : Carbon::createFromFormat('Y-m-d', $date); $data = ['envelope' => $envelope, 'date' => $date, 'prevYear' => $date->copy()->subYear(), 'nextYear' => $date->copy()->addYear(), 'chart' => LineChart::forge($envelope, $date, LineChart::PERIOD_YEAR)]; return view('envelope.development.yearly', $data); }
public function __construct() { $this->user = Auth::user(); $this->length = 'month'; $this->start_date = $this->length == 'month' ? Carbon::today()->subMonth() : Carbon::today()->subWeek(); $this->end_date = Carbon::today(); }
/** * Checks if number of todays messages are greater than max * @return boolean [description] */ public function isAboveMax() { if ($this->message->where('post_date', '>', Carbon::today())->count() > config('crm-launcher.notification.crm_notify_from_messages')) { return true; } return false; }
public function testMethod() { $pickupDateReminder = config('app.pickup_reminder_days_to_remind'); $today = Carbon::today('America/Halifax'); $twoDaysFromNow = Carbon::today('America/Halifax')->addDay($pickupDateReminder); $startWorkOrders = WorkOrder::whereDate('start_date', '=', $today)->get(); $startCount = $startWorkOrders->count(); $endWorkOrders = WorkOrder::whereDate('end_date', '=', $twoDaysFromNow)->with('product', 'customer')->get(); $endCount = $endWorkOrders->count(); $endDueDate = $twoDaysFromNow->toFormattedDateString(); $viewData = ['todaysDate' => $today->toFormattedDateString(), 'startCount' => $startCount, 'endCount' => $endCount, 'startWorkOrders' => $startWorkOrders, 'endWorkOrders' => $endWorkOrders, 'endDueDate' => $endDueDate, 'pickupDateReminder' => $pickupDateReminder]; $to = config('app.pickup_reminder_email_to'); $from = config('app.pickup_reminder_email_from'); $subject = config('app.pickup_reminder_email_subject'); $view = config('app.pickup_reminder_email_view'); Mail::send($view, ['viewdata' => $viewData], function ($message) use($viewData, $to, $from, $subject) { $message->from($from); $message->to($to); $message->subject($subject); }); /* return view(config('app.pickup_reminder_email_view'))->with(['todaysDate' => $today->toFormattedDateString(), 'startCount' => $startCount, 'endCount' => $endCount, 'startWorkOrders' => $startWorkOrders, 'endWorkOrders' => $endWorkOrders, 'endDueDate' => $endDueDate, 'pickupDateReminder' => $pickupDateReminder ]); */ echo 'Done'; }
/** * @test */ public function it_gets_the_diff() { $today = Carbon::today(); $logDate = Carbon::today()->subDays(10); $log = "laravel-{$logDate->toDateString()}.log"; $this->assertSame(10, LogUtil::diffInDays($log, $today)); }
/** * Verify that a given license is both 'active' and 'current' (i.e. has * not expired, etc.). * * @param License $lic * @return boolean */ protected function isCurrent(License $lic) { $valid = [STATUS_ACTIVE, STATUS_LOCKED, STATUS_PENDING]; $active = $this->isActive($lic->status, $valid); $today = Carbon::today(); return $active && $lic->start_at->lte($today) && $lic->end_at->gte($today); }
public function testAujoudHuiReturnTheDateOfToday() { $now = Carbon::now(); $dt = SearchResultDateTimeParser::toDt("Aujourd'hui", "{$now->hour}:{$now->minute}"); $expected = Carbon::today()->hour($now->hour)->minute($now->minute)->format('Y-m-d H:m'); $this->assertEquals($expected, $dt); }
/** * Execute the console command. * * @return mixed */ public function handle() { $today = Carbon::today(); $nextMonth = Carbon::today()->addMonth(); $monday = new Carbon('next monday'); $sunday = new Carbon('next monday'); $sunday->addDays(6); echo $sunday; $planningen = Planning::where('first_day', '>', $today)->get(); var_dump($planningen); while ($monday < $nextMonth) { $not_exists = true; foreach ($planningen as $planning) { if ($monday >= $planning->first_day && $monday <= $planning->last_day) { $not_exists = false; } } if ($not_exists) { $newPlanning = new Planning(); $newPlanning->first_day = $monday; $newPlanning->last_day = $sunday; $newPlanning->save(); } $monday->addWeek(); $sunday->addWeek(); } }