fixes on addresses
This commit is contained in:
@@ -70,7 +70,7 @@ class Customers
|
||||
{
|
||||
$customer = $id ? self::get($id) : self::getAuth();
|
||||
$file = self::makeAvatarFilename($customer);
|
||||
if (! File::checkFile($file)) {
|
||||
if (!File::checkFile($file)) {
|
||||
self::createAvatar($customer);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class Customers
|
||||
public static function createAvatar($customer)
|
||||
{
|
||||
$filename = self::makeAvatarFilename($customer);
|
||||
$name = $customer->first_name.' '.$customer->last_name;
|
||||
$name = $customer->first_name . ' ' . $customer->last_name;
|
||||
$avatar = new Avatar();
|
||||
|
||||
return $avatar->create($name)
|
||||
@@ -97,7 +97,7 @@ class Customers
|
||||
{
|
||||
$path = storage_path(self::getStorage());
|
||||
if (File::checkDirOrCreate($path)) {
|
||||
$filename = $path.self::getAvatarFilename($customer);
|
||||
$filename = $path . self::getAvatarFilename($customer);
|
||||
}
|
||||
|
||||
return $filename ?? false;
|
||||
@@ -105,7 +105,7 @@ class Customers
|
||||
|
||||
public static function getAvatarFilename($customer)
|
||||
{
|
||||
return 'user-'.$customer->uuid.'.png';
|
||||
return 'user-' . $customer->uuid . '.png';
|
||||
}
|
||||
|
||||
public static function getAddresses($id = false)
|
||||
@@ -141,7 +141,7 @@ class Customers
|
||||
|
||||
public static function isNotConnected()
|
||||
{
|
||||
return ! self::isConnected();
|
||||
return !self::isConnected();
|
||||
}
|
||||
|
||||
public static function isConnected()
|
||||
@@ -161,19 +161,26 @@ class Customers
|
||||
|
||||
public static function storeFull($data)
|
||||
{
|
||||
$saleChannels = $data['sale_channels'];
|
||||
unset($data['sale_channels']);
|
||||
$customer = self::store($data);
|
||||
if ($customer) {
|
||||
self::storeSaleChannels($customer->id, $saleChannels);
|
||||
$data2 = $data;
|
||||
if ($data['sale_channels'] ?? false) {
|
||||
$saleChannels = $data['sale_channels'] ?? false;
|
||||
unset($data['sale_channels']);
|
||||
}
|
||||
if ($data['deliveries'] ?? false) {
|
||||
unset($data['deliveries']);
|
||||
}
|
||||
if ($data['invoices'] ?? false) {
|
||||
unset($data['invoices']);
|
||||
}
|
||||
$customer = self::store($data);
|
||||
CustomerAddresses::storeByCustomer($customer, $data2);
|
||||
|
||||
return $customer->id;
|
||||
}
|
||||
|
||||
public static function storeDeliveries($customer, $deliveries)
|
||||
{
|
||||
if (! $deliveries) {
|
||||
if (!$deliveries) {
|
||||
return false;
|
||||
}
|
||||
$deliveries = collect($deliveries)->transform(function ($item) {
|
||||
@@ -220,14 +227,14 @@ class Customers
|
||||
{
|
||||
$path = '/app/public/Customers/';
|
||||
|
||||
return $filename ? $path.$filename : $path;
|
||||
return $filename ? $path . $filename : $path;
|
||||
}
|
||||
|
||||
public static function getPublic($filename = false)
|
||||
{
|
||||
$path = '/storage/Customers/';
|
||||
|
||||
return $filename ? $path.$filename : $path;
|
||||
return $filename ? $path . $filename : $path;
|
||||
}
|
||||
|
||||
public static function guard()
|
||||
|
||||
Reference in New Issue
Block a user