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.
You have 2 options for installation:
- If you are using Windows or MacOS You must install
Docker Desktop
on your system - If you are using Linux or MacOS You must have
Docker Engine
andDocker Compose
on your system - visit docker documents for more information
- make an empty directory everywhere you want =>
mkdir -p shop
- Clone the repo => run
git clone https://github.com/saber13812002/laravel-ecommerce-example.git
- go to project directory => run
cd laravel-ecommerce-example
- make .env file and review its variables =>
cp .env.example .env
- run
docker-compose up -d
- wait for minutes to initializing databse (only at firsttime)
- enter
http://localhost:8000
to see the shop's homepage - enter
http://localhost:8080
to see the shop's database- you can use
DB_DATABASE
,DB_USERNAME
andDB_PASSWORD
for login to phpmyadmin
- you can use
- enter http://localhost:8000/admin if you want to access the
Laravel-Admin.org admin backend
.- Admin User/Password:
admin/admin
- Admin User/Password:
- enter http://localhost:8000/admin2 if you want to access the
Voyager admin backend
.- Admin email/password:
admin@admin.com/password
. - Admin Web email/password:
adminweb@adminweb.com/password
- Admin email/password:
- Clone the repo and
cd
into itgit clone https://github.com/saber13812002/laravel-ecommerce-example.git
composer install
- Rename or copy
.env.example
file to.env
=>cp .env.example .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 Algolia credentials in your
.env
file. SpecificallyALGOLIA_APP_ID
andALGOLIA_SECRET
. See this episode. - Set your Braintree credentials in your
.env
file if you want to use PayPal. SpecificallyBT_MERCHANT_ID
,BT_PUBLIC_KEY
,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
APP_URL
in your.env
file. This is needed for Voyager to correctly resolve asset URLs. - Set
ADMIN_PASSWORD
forvoyager admin panel 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 necessary. See this episode.'php artisan admin:install
. for laravel-admin.org admin panel ...npm install
npm run dev
php artisan serve
or use Laravel Valet or Laravel Homestead- Visit
localhost:8000
in your browser - Visit
/admin2
if you want to access the Voyager admin backend. Admin User/Password:admin@admin.com/password
. Admin Web User/Password:adminweb@adminweb.com/password
- Visit
/admin
if you want to access the Laravel-Admin.org admin backend. Admin User/Password:username:admin/password:admin
- voyager using config/voyager.php file
'storage' => [ 'disk' => env('FILESYSTEM_DRIVER', 'public'), ],
- https://gist.github.com/saber13812002/75db95cc2ce47067e8730f3ff8e9def5
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.
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);
- In
config/cart.php
set thethousand_seperator
to an empty string or you might get a 'non well formed numeric value encountered' error. It conflicts withnumber_format
.
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
when you run npm run prod
- git move all your changes in public into server
- but your results in public_html and you need to copy them when you changes vuejs files
- so you need to overwrite them with laravel.bat
- by running ./laravel.bat
You can Fork this project and modify files
...