Laravel E-Commerce Application Development( 27 Lessons )
來源:Laravel E-Commerce Application Development( 27 Lessons )
這個教學是一個完整建立一個EC網站教學,使用Laravel 5.8 與 Vue (前端),共有27個教學,根據裏面的教學可能作者沒有交待完整或建置過程有疏漏,使得無法建立的應用程式無法正常運作,此時可以使用作者提供的源碼先建立一個參考範例,再閱讀作者的教學。
這個電子商務要大致滿足以下的需求:
- A catalog page where all products will be displayed to buyers. 買家觀看的產品目錄頁
- A product details page where buyers can find more information about the product. 產品細節頁面,買家可以透過這個頁面發現商品更多的資訊。
- A checkout system, where buyers can enter the shipping address and pay. 結帳系統,買家可以輸入送貨地址並且進行付款。
- Login and registration pages so buyers can register or login to their account. 供買家登入與註冊的頁面。
- Account dashboard for customers where they can see recent orders placed, or can change their account details. 帳號資訊與管理頁面,買家可以用來檢視訂單,或者修改帳號資料。
- An admin area where shop owner can log in and manage followings: 後台管理介面,供商品管理者登入並且管理下列事項
- Manage store settings. 管理商店設定
- Manage products, categories, brands, product attributes. 管理產品、目錄、品牌、產品資料
- Manage sales orders and can generate reports. 管理銷售訂單,並產生各式報表
- Manage payment methods available to customers. 管理客戶的可用付款方法
- Manage Shipping methods available to customers. 管理客戶的可用貨物物流方法
- Manage admin users so other staff members use the admin area. 管理使用者帳號,讓其他職員/店員也能使用後台管理介面。
這個系統使用 Bootstrap E-commerce UI Kit 作為前端工具, Vali Admin 為後端管理介面範本,這2個工具都是使用Bootstrap 4為基底所開發出來的?
直接run作者提供的源碼 (20200622)
- 下載並解開在 github上的源碼
- 執行 composer install
- 依照.env上的資料庫設定新增一個資料庫(homestead,並設置資料庫帳號與密碼)
- 執行 php artisan migrate,建立專案的表格,不過注意,在這個步驟建立連外鍵時會出現許多錯誤,必須依照發生的錯誤訊息至Database\migrations目錄找相關的表格schema,把連外鍵的unsignedInteger改成unsignedBigInteger,例:
- 執行 php artisan migrate – -seed (2個橫線)
- 執行 npm install (需先安裝Nodejs)
- 執行 npm run watch (這個步驟會將需要用到的前端套件複製到public目錄)
- php artisan serve
- 成功執行出現的畫面:
- Laravel E-Commerce Application Development – Introduction
- Laravel E-Commerce Application Development – Initial Project Setup
- Laravel E-Commerce Application Development – Assets Setup Using Laravel Mix
- Laravel E-Commerce Application Development – Admin Model and Migration
- Laravel E-Commerce Application Development – Backend Admin Authentication
筆記:admin.php
<?php Route::group(['prefix' => 'admin'], function () { Route::get('login', 'Admin\LoginController@showLoginForm')->name('admin.login'); Route::post('login', 'Admin\LoginController@login')->name('admin.login.post'); Route::get('logout', 'Admin\LoginController@logout')->name('admin.logout'); // Route::get('/', function () { // return view('admin.dashboard.index'); // }); Route::group(['middleware' => ['auth:admin']], function () { Route::get('/', function () { return view('admin.dashboard.index'); })->name('admin.dashboard'); }); }); // Route::group(['middleware' => ['auth:admin']], function () { // // Route::get('/', function () { // return view('admin.dashboard.index'); // })->name('admin.dashboard'); // // });
- Laravel E-Commerce Application Development – Base Controller and Repository
- Laravel E-Commerce Application Development – Settings Section Part 1
- Laravel E-Commerce Application Development – Settings Section Part 2
- Laravel E-Commerce Application Development – Categories Section Part 1
- Laravel E-Commerce Application Development – Categories Section Part 2
- Laravel E-Commerce Application Development – Attributes Section Part 1
- Laravel E-Commerce Application Development – Attributes Section Part 2
- Laravel E-Commerce Application Development – Attributes Section Part 3
- Laravel E-Commerce Application Development – Brands Section
- Laravel E-Commerce Application Development – Products Section Part 1
- Laravel E-Commerce Application Development – Products Section Part 2
- Laravel E-Commerce Application Development – Products Section Part 3
- Laravel E-Commerce Application Development – Products Section Part 4
- Laravel E-Commerce Application Development – Frontend Login & Registration
- Laravel E-Commerce Application Development – Categories Navigation
- Laravel E-Commerce Application Development – Catalog Listing
- Laravel E-Commerce Application Development – Product Details Page
- Laravel E-Commerce Application Development – Shopping Cart
- Laravel E-Commerce Application Development – Checkout
- Laravel E-Commerce Application Development – Payment Processing
- Laravel E-Commerce Application Development – Order Management
- Laravel E-Commerce Application Development – Wrap Up