mivita/app/Services/SyS/UserCreditItemsAddFrom.php
Kevin Adametz bfa3bb1df4 08 2024
2024-08-05 12:05:24 +02:00

48 lines
899 B
PHP

<?php
namespace App\Services\SyS;
use Request;
use Carbon;
use App\Models\SySetting;
use App\Models\ShoppingOrder;
use App\Models\UserCreditItem;
use App\User;
class UserCreditItemsAddFrom
{
public static function show()
{
UserCreditItem::all()->each(function($item){
$date = self::getExplodeMessage($item);
$item->from_month = $date['n'];
$item->from_year = $date['Y'];
$item->save();
});
dd("done");
}
private static function getExplodeMessage($item){
$date = [];
if(strpos($item->message, '#')){
$em = explode("#", $item->message);
if(isset($em[1])){ //month
$data['n'] =$em[1];
}
if(isset($em[2])){ //year
$data['Y'] =$em[2];
}
}
return $data;
}
public static function store()
{
abort(403, 'STOP funtion not online');
dd("");
}
}