Laravel Ecommerce Example
Code for YouTube video series: https://www.youtube.com/watch?v=o5PWIuDTgxg&list=PLEhEHUEU3x5oPTli631ZX9cxl6cU_sDaR
Website Demo: https://laravelecommerceexample.ca. The demo has limited permissions. Install locally for full access.
- Clone the repo and
- Rename or copy
php artisan key:generate
- Set your database credentials in your
- Set your Stripe credentials in your
- Set your Algolia credentials in your
ALGOLIA_SECRET. See this episode.
- Set your Braintree credentials in your
.envfile if you want to use PayPal. Specifically
BT_PRIVATE_KEY. See this episode. If you don't, it should still work but won't show the paypal payment at checkout.
- Set your
.envfile. This is needed for Voyager to correctly resolve asset URLs.
.envfile if you want to specify an admin password. If not, the default password is 'password'
php artisan ecommerce:install. This will migrate the database and run any seeders necessary. See this episode.
npm run dev
php artisan serveor use Laravel Valet or Laravel Homestead
localhost:8000in your browser
/adminif you want to access the Voyager admin backend. Admin User/Password:
firstname.lastname@example.org/password. Admin Web User/Password:
Shopping Cart Package
I originally used the Crinsane/LaravelShoppingcart package but it is slow to update to the latest versions of Laravel. I now use hardevine/LaravelShoppingcart which is a forked version that updates quicker.
Windows Users - money_format() issue
money_format function does not work in Windows. Take a look at this thread. As an alternative, just use the
number_format function instead.
return '$'.number_format($price / 100, 2);
return '$'.number_format($this->price / 100, 2);
thousand_seperatorto an empty string or you might get a 'non well formed numeric value encountered' error. It conflicts with
Starting from a particular point
If you would like to follow along from a particular point, follow these instructions. I'm going to be starting from my starting point in the first video of the series. You can choose any point by replacing the hash with any particular commit.
- Clone the repo and
git checkout f4f651a8a35ebb2ff38ba15771fd65c93051f942
- Follow the rest of the steps above. Instead of
php artisan ecommerce:install, migrate and seed the normal way with
php artisan migrate --seed