ro
573054e7d8
The Location Controller was getting too heavy so an Update and Maintenance service class was created to offload most of it's functionality. Location upating was moved to LocationRepository There was also a small issue with responsive list links not adapting properly in Safari that was fixed
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Models\Location;
|
|
|
|
class MaintenanceService
|
|
{
|
|
//TODO: maintenance script to set locations to inactive if they haven't been updated
|
|
// over 90 days
|
|
|
|
//$diff=date_diff($location->updated_at, new DateTime());
|
|
//$days = $diff->format("%R%a days")
|
|
|
|
//$interval = $location->updated_at->diff(new DateTime());
|
|
//$days = $interval->format("%a");
|
|
|
|
//get all locations and sort which are present in unified or not
|
|
/*
|
|
$sorted = [];
|
|
$listed = 0;
|
|
$notlisted = 0;
|
|
foreach (Location::all() as $location) {
|
|
if (array_search($location->url, array_column($unified, 'url'))) {
|
|
++$listed;
|
|
// locations present in unfied, so updated
|
|
array_push($sorted, [
|
|
'location' => $location,
|
|
'listed' => true
|
|
]);
|
|
} else {
|
|
++$notlisted;
|
|
//locations not present
|
|
array_push($sorted, [
|
|
'location' => $location,
|
|
'listed' => false
|
|
]);
|
|
}
|
|
};
|
|
*/
|
|
}
|