mirror of
https://koodu.h-i.works/projects/thebadspace
synced 2025-06-25 16:04:37 -05:00
Cleaned up location controller, responsive fix
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
This commit is contained in:
41
app/Services/MaintenanceService.php
Normal file
41
app/Services/MaintenanceService.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?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
|
||||
]);
|
||||
}
|
||||
};
|
||||
*/
|
||||
}
|
Reference in New Issue
Block a user