Файловый менеджер - Редактировать - /home/clickysoft/public_html/somni.clickysoft.net/app/Helpers/Helper.php
Назад
<?php namespace App\Helpers; use Illuminate\Support\Str; use Carbon\Carbon; use App\Models\Package; class Helper { public static function convertRentDueDateToCuurentDate($rent_due_date){ $rent_due_date = \Carbon\Carbon::parse($rent_due_date); $currentYear = \Carbon\Carbon::now()->year; $newRentDueDate = $rent_due_date->year($currentYear); $newRentDueDateString = $newRentDueDate->format('M d, Y'); return $newRentDueDateString; } public static function getPercentageAmount($percentage, $amount){ $result = ($amount * $percentage) / 100; return $result; } public static function snakeToCapitalize($snakeCaseText){ $capitalizedText = Str::title(str_replace('_', ' ', $snakeCaseText)); return $capitalizedText; } public static function calculateBillingPeriod($month, $year, $rentDueDate) { // $startDate = new DateTime("$year-$month-01"); // $endDate = new DateTime($startDate->format("Y-m-t")); // $formattedStartDate = $startDate->format("M. d, Y"); // $formattedEndDate = $endDate->format("M. d, Y"); // return "$formattedStartDate - $formattedEndDate"; $startDate = Carbon::createFromDate($year, $month, 1); $endDate = $startDate->copy()->endOfMonth(); // If a specific rent due date is provided, adjust the end date if ($rentDueDate) { $endDate = Carbon::createFromFormat('Y-m-d', $rentDueDate)->endOfMonth(); } $formattedStartDate = $startDate->isoFormat("MMM. DD, YYYY"); $formattedEndDate = $endDate->isoFormat("MMM. DD, YYYY"); return "$formattedStartDate - $formattedEndDate"; } public static function getPackageByStripePriceId($id){ return Package::where('stripe_price_id',$id)->first(); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0.01 |
proxy
|
phpinfo
|
Настройка