¨4.0.1¨
This commit is contained in:
@@ -2,24 +2,28 @@
|
||||
|
||||
namespace Modules\Wishlist\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class WishlistController
|
||||
{
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
if (! auth()->user()->wishlistHas(request('productId'))) {
|
||||
if (!auth()->user()->wishlistHas(request('productId'))) {
|
||||
auth()->user()->wishlist()->attach(request('productId'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Destroy resources by the given id.
|
||||
*
|
||||
* @param string $productId
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function destroy($productId)
|
||||
|
||||
@@ -2,19 +2,21 @@
|
||||
|
||||
namespace Modules\Wishlist\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class WishlistProductController
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return auth()->user()
|
||||
->wishlist()
|
||||
->with('files')
|
||||
->latest()
|
||||
->paginate(20);
|
||||
->orderByPivot('created_at', 'desc')
|
||||
->paginate(10);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user