Pint
This commit is contained in:
@@ -5,11 +5,9 @@ namespace App\Livewire;
|
||||
use App\Models\Episode;
|
||||
use App\Models\User;
|
||||
use App\Models\UserDownload;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Livewire\Component;
|
||||
|
||||
class DownloadsFree extends Component
|
||||
{
|
||||
@@ -51,6 +49,7 @@ class DownloadsFree extends Component
|
||||
if (Carbon::parse($alreadyDownloaded->created_at)->addHours(6) <= Carbon::now()) {
|
||||
// Already expired
|
||||
$alreadyDownloaded->delete();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,6 +64,7 @@ class DownloadsFree extends Component
|
||||
if ($user->downloads_left <= 0) {
|
||||
// Daily limit reached
|
||||
$this->granted = 3;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ class DownloadsFree extends Component
|
||||
$this->granted = 1;
|
||||
|
||||
UserDownload::create([
|
||||
'user_id' => $user->id,
|
||||
'episode_id' => $this->episodeId,
|
||||
'interpolated' => $this->interpolated,
|
||||
'user_id' => $user->id,
|
||||
'episode_id' => $this->episodeId,
|
||||
'interpolated' => $this->interpolated,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user