Add "shopavel/customers": "1.0.*"
to your composer.json
and run composer update
.
This package is required by shopavel/shop
, you will not normally have to specifically require this package.
In app/config/app.php
add 'Shopavel\Customers\CustomersServiceProvider'
to your providers
list and 'Customer' => 'Shopavel\Customers\Facades\Customer'
to your aliases
list.
You can use the Customer
alias to access the customer eloquent model.
Basket
$basket = Customer::find(1)->getBasket();
Orders
$orders = Customer::find(1)->getOrders();
Use the customer.registration
service to register customers.
Register a customer
app('customer.registration')->register($customer);
Use the customer.auth
service to manage authentication of customers.
Authenticate a customer
app('customer.auth')->authenticate($email, $password);
Log out a customer
app('customer.auth')->logout();
Use the customer.basket
service to manage the customer's basket.
Set the customers basket
app('customer.basket')->setBasket($customer, $basket);
Use the customer.orders
service to access the customer's orders.
Add an order to a customer
app('customer.orders')->addOrder($customer, $order);
All Shopavel packages are open-sourced software licensed under the MIT license