Skip to content

Commit

Permalink
fix(storage): Add missing namespace, define vars
Browse files Browse the repository at this point in the history
  • Loading branch information
zooley committed Aug 18, 2023
1 parent 1ffb84b commit 8625a96
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 34 deletions.
9 changes: 6 additions & 3 deletions app/Modules/Storage/Http/Controllers/Api/UsageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Collection;
use App\Modules\Storage\Http\Resources\UsageResource;
use App\Modules\Storage\Http\Resources\UsageResourceCollection;
use App\Modules\Storage\Models\Usage;
use App\Modules\Storage\Models\Directory;
use App\Modules\Storage\Models\StorageResource;
use App\Modules\Resources\Models\Asset;
use App\Modules\Users\Models\User;
use Carbon\Carbon;

/**
Expand All @@ -39,7 +41,7 @@ class UsageController extends Controller
* }
* }
* @param Request $request
* @return Collection
* @return Collection|array<int,\stdClass>
*/
public function index(Request $request)
{
Expand Down Expand Up @@ -560,7 +562,7 @@ public function delete($id)
* @param string $resource
* @param string $dir
* @param Request $request
* @return UsageResourceCollection
* @return JsonResponse|UsageResourceCollection
*/
public function batch($resource, $dir, Request $request)
{
Expand Down Expand Up @@ -617,6 +619,7 @@ public function batch($resource, $dir, Request $request)
}

$data = explode("\n", $contents);
$rows = array();

foreach ($data as $line)
{
Expand Down Expand Up @@ -699,7 +702,7 @@ public function batch($resource, $dir, Request $request)
$row->lastinterval = Carbon::now()->timestamp - strtotime($last->datetimerecorded);
}

$row->datetimerecorded = Carbon::now()->toDateTimeString();
$row->datetimerecorded = Carbon::now();
$row->save();

$rows[] = $row;
Expand Down
10 changes: 0 additions & 10 deletions app/Modules/Storage/Http/Resources/DirectoryResourceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,4 @@

class DirectoryResourceCollection extends ResourceCollection
{
/**
* Transform the resource collection into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return parent::toArray($request);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace App\Modules\Storage\Http\Resources;

use Illuminate\Http\Resources\Json\ResourceCollection;

class UsageResourceCollection extends ResourceCollection
{
}
22 changes: 1 addition & 21 deletions app/Modules/Storage/Providers/StorageServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,6 @@ public function boot()
}
}

/**
* Register the service provider.
*
* @return void
*/
public function register()
{
//
}

/**
* Register console commands.
*
Expand Down Expand Up @@ -148,7 +138,7 @@ public function registerViews()
$this->loadViewsFrom(array_merge(array_map(function ($path)
{
return $path . '/modules/' . $this->name;
}, config('view.paths')), [$sourcePath]), $this->name);
}, config('view.paths', [])), [$sourcePath]), $this->name);
}

/**
Expand All @@ -167,14 +157,4 @@ public function registerTranslations()

$this->loadTranslationsFrom($langPath, $this->name);
}

/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [];
}
}

0 comments on commit 8625a96

Please sign in to comment.