php - Carbon date formatting instance for laravel 8.12
one text
I have an array that is supposed to return the following date time:
$end_at = Carbon::now()->$toexpire($digit)->toDateTimeString();
but after upgrading from laravel 7 to 8.12, i get this error when i sign up for a plan from my website dashboard
TypeError Carbon\Carbon::singularUnit(): Argument #1 ($unit) must be of type string, null given, called in /home/legitmet/public_html/vendor/nesbot/carbon/src/Carbon/Traits/Units.php on line 239
this is the full function
public function joinPlan(){
sleep(2);
$this->feedback = 'Please wait';
//get user
$user=User::where('id',Auth::user()->id)->first();
//get plan
$plan=Plans::where('id',$this->planSelected->id)->first();
// setup
$expiration = explode(" ", $plan->expiration);
$digit = $expiration[0];
$frame = $expiration[1];
$toexpire = "add". $frame;
$end_at = Carbon::now()->$toexpire($digit)->toDateTimeString();
Source