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
cd
into it composer install
- Rename or copy
.env.example
file to.env
php artisan key:generate
- Set your database credentials in your
.env
file - Set your Stripe credentials in your
.env
file. SpecificallySTRIPE_KEY
andSTRIPE_SECRET
- Set your
APP_URL
in your.env
file. This is needed for Voyager to correctly resolve asset URLs. - Set
ADMIN_PASSWORD
in your.env
file 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 necessarynpm install
npm run dev
php artisan serve
or use Laravel Valet or Laravel Homestead- Visit
localhost:8000
in your browser - Visit
/admin
if you want to access the Voyager admin backend. Admin User/Password:admin@admin.com/password
. Admin Web User/Password:adminweb@adminweb.com/password
The money_format
function does not work in Windows. Take a look at this thread. As an alternative, just use the number_format
function instead.
- In
app/helpers.php
replacemoney_format
line withreturn '$'.number_format($price / 100, 2);
- In
app/Product.php
replacemoney_format
line withreturn '$'.number_format($this->price / 100, 2);
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
cd
into it git checkout f4f651a8a35ebb2ff38ba15771fd65c93051f942
- Follow the rest of the steps above. Instead of
php artisan ecommerce:install
, migrate and seed the normal way withphp artisan migrate --seed