mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Fix logic and add check for duplicated data
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2019-03-21 DariusIII
|
||||
* Fix: Fix logic and add check for duplicated data
|
||||
* Chg: Use separate query to add releases to cart as we only need the id, so no need to use heavier getByGuid function
|
||||
* Chg: Update font-awesome to latest version
|
||||
* Chg: Update rtconner/laravel-tagging (3.1.0 => 3.1.1), wildbit/swiftmailer-postmark (3.0.1 => 3.0.2)
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Release;
|
||||
use App\Models\UsersRelease;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
@@ -40,12 +41,15 @@ class CartController extends BasePageController
|
||||
|
||||
$data = Release::query()->whereIn('guid', $guids)->select(['id'])->get();
|
||||
|
||||
if (! empty($data)) {
|
||||
if (empty($data)) {
|
||||
return redirect('/cart/index');
|
||||
}
|
||||
|
||||
foreach ($data as $d) {
|
||||
UsersRelease::addCart($this->userdata->id, $d['id']);
|
||||
$check = UsersRelease::whereReleasesId($d['id'])->first();
|
||||
if (empty($check)) {
|
||||
UsersRelease::addCart($this->userdata->id, $d['id']);
|
||||
}
|
||||
}
|
||||
return redirect('/cart/index');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user