controller refactoring part 17

This commit is contained in:
Peter Papp
2021-07-21 11:20:41 +02:00
parent e0eaf5cede
commit dccf98602d
21 changed files with 370 additions and 94 deletions

View File

@@ -16,7 +16,6 @@ use App\Users\Notifications\ResetPassword;
use Domain\Subscriptions\Traits\Subscription;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Domain\Traffic\Models\Traffic as TrafficModel;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -128,38 +127,6 @@ class User extends Authenticatable implements MustVerifyEmail
return $this->hasOne(UserSettings::class);
}
/**
* Record user upload filesize
*/
public function recordUpload(int $file_size): void
{
$record = TrafficModel::whereYear('created_at', '=', now()->year)
->whereMonth('created_at', '=', now()->month)
->firstOrCreate([
'user_id' => $this->id,
]);
$record->update([
'upload' => $record->upload + $file_size,
]);
}
/**
* Record user download filesize
*/
public function recordDownload(int $file_size): void
{
$record = TrafficModel::whereYear('created_at', '=', now()->year)
->whereMonth('created_at', '=', now()->month)
->firstOrCreate([
'user_id' => $this->id,
]);
$record->update([
'download' => $record->download + $file_size,
]);
}
/**
* Get user favourites folder
*/