Downloads
Stars
Version
Install the package via composer:
composer require yaroslawww/laravel-quick-checkout
You can publish the config file with:
php artisan vendor:publish --provider="QuickCheckout\ServiceProvider" --tag="config"
Example usage:
public function addToCart(Course $course) {
/** @var \QuickCheckout\Cart $cart */
$cart = \QuickCheckout\Checkout::cart()->purge()
->withLineItem($course->toCheckoutProduct(), 2)
->withLineItem(new Product('My other product', 123), 4)
->putToSession();
// ... response or redirect
}
public function showCheckout(Course $course) {
/** @var \QuickCheckout\Cart $cart */
$cart = \QuickCheckout\Checkout::cart()->fromSession();
// ... response or redirect
}
Model configuration:
use Illuminate\Database\Eloquent\Model;
use QuickCheckout\Contracts\UsedAsCheckoutProduct;
use QuickCheckout\Eloquent\AsCheckoutProduct;
class Course extends Model implements UsedAsCheckoutProduct
{
use AsCheckoutProduct;
// ...
}