helpers refactoring

This commit is contained in:
Peter Papp
2021-03-31 08:27:28 +02:00
parent 6ac6528243
commit a8fa3694be
30 changed files with 85 additions and 211 deletions
+5 -14
View File
@@ -39,8 +39,8 @@ class DemoService
'items' => '0',
'color' => isset($request->icon['color']) ? $request->icon['color'] : null,
'emoji' => isset($request->icon['emoji']) ? $request->icon['emoji'] : null,
'updated_at' => Carbon::now()->format('j M Y \a\t H:i'),
'created_at' => Carbon::now()->format('j M Y \a\t H:i'),
'updated_at' => now()->format('j M Y \a\t H:i'),
'created_at' => now()->format('j M Y \a\t H:i'),
];
}
@@ -111,24 +111,15 @@ class DemoService
'type' => $filetype,
'file_url' => 'https://vuefilemanager.hi5ve.digital/assets/vue-file-manager-preview.jpg',
'author' => $request->user() ? 'user' : 'visitor',
'created_at' => Carbon::now()->format('j M Y \a\t H:i'),
'updated_at' => Carbon::now()->format('j M Y \a\t H:i'),
'created_at' => now()->format('j M Y \a\t H:i'),
'updated_at' => now()->format('j M Y \a\t H:i'),
];
}
/**
* Return 204 status
*
* @return ResponseFactory|\Illuminate\Http\Response
*/
function response_with_no_content()
{
return response('Done!', 204);
}
/**
* Return 204 status
*
* @param $user
* @return ResponseFactory|\Illuminate\Http\Response
*/
function favourites($user)
+3 -3
View File
@@ -17,7 +17,7 @@ class SchedulerService
*/
public function delete_old_zips(): void
{
Zip::where('created_at', '<=', Carbon::now()->subDay()->toDateTimeString())
Zip::where('created_at', '<=', now()->subDay()->toDateTimeString())
->get()
->each(function ($zip) {
@@ -42,7 +42,7 @@ class SchedulerService
$created_at = Carbon::parse($share->created_at);
// If time was over, then delete share record
if ($created_at->diffInHours(Carbon::now()) >= $share->expire_in) {
if ($created_at->diffInHours(now()) >= $share->expire_in) {
$share->delete();
}
});
@@ -69,7 +69,7 @@ class SchedulerService
// Get diffInHours
$diff = Carbon::parse($last_modified)
->diffInHours(Carbon::now());
->diffInHours(now());
// Delete if file is in local storage more than 24 hours
if ($diff >= 24) {