add shipping rules
This commit is contained in:
@@ -10,7 +10,7 @@ class ApplicationClients
|
||||
public static function associate($client_id, $applications_list)
|
||||
{
|
||||
$applications_existing = self::getApplicationsByClient($client_id);
|
||||
$applications_list = is_array($applications_list) ? $applications_list : array();
|
||||
$applications_list = is_array($applications_list) ? $applications_list : [];
|
||||
|
||||
if (is_array($applications_existing)) {
|
||||
$applications_new = array_diff($applications_list, $applications_existing);
|
||||
@@ -20,9 +20,9 @@ class ApplicationClients
|
||||
$applications_to_delete = [];
|
||||
}
|
||||
|
||||
$history_element_infos = (!empty($applications_new)) ? self::associateApplications($client_id, $applications_new) : false;
|
||||
$history_element_infos2 = (!empty($applications_to_delete)) ? self::dissociateApplications($client_id, $applications_to_delete) : false;
|
||||
|
||||
$history_element_infos = (! empty($applications_new)) ? self::associateApplications($client_id, $applications_new) : false;
|
||||
$history_element_infos2 = (! empty($applications_to_delete)) ? self::dissociateApplications($client_id, $applications_to_delete) : false;
|
||||
|
||||
$data['nb'] = self::countByClient($client_id);
|
||||
|
||||
return $data;
|
||||
@@ -42,12 +42,13 @@ class ApplicationClients
|
||||
self::associateApplication($client_id, $application_id);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function associateApplication($client_id, $application_id)
|
||||
{
|
||||
return ApplicationClient::create(['client_id' => $client_id, 'application_id' => $application_id, 'active' => true ]);
|
||||
return ApplicationClient::create(['client_id' => $client_id, 'application_id' => $application_id, 'active' => true]);
|
||||
}
|
||||
|
||||
public static function dissociateApplications($client_id, $applications)
|
||||
@@ -56,6 +57,7 @@ class ApplicationClients
|
||||
foreach ($applications as $key => $application_id) {
|
||||
self::dissociateApplication($client_id, $application_id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -86,6 +88,6 @@ class ApplicationClients
|
||||
|
||||
public static function isActiveByName($name)
|
||||
{
|
||||
return (!Clients::isClient()) ? true : ApplicationClient::bySlug($name)->byClient(Clients::getId())->first()->active ?? false;
|
||||
return (! Clients::isClient()) ? true : ApplicationClient::bySlug($name)->byClient(Clients::getId())->first()->active ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user