PHP code example of lamalama / laravel-wishlist

1. Go to this page and download the library: Download lamalama/laravel-wishlist library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lamalama / laravel-wishlist example snippets


use LamaLama\Wishlist\HasWishlists;

use HasWishlists;

use LamaLama\Wishlist\Wishlistable;

use Wishlistable;

$user = User::find(1);
$product = Product::find(1);
$user->wish($product);

$user->wish($product, 'Christmas presents');

$user->unwish($product);
$user->unwish($product, 'Christmas presents');

$user->wishlists();

$user->wishlist('Christmas presents');
bash
php artisan vendor:publish --provider="LamaLama\Wishlist\WishlistServiceProvider" --tag="migrations"
bash
php artisan migrate
bash
php artisan vendor:publish --provider="LamaLama\Wishlist\WishlistServiceProvider" --tag="config"