# 2021/05/07課堂練習 **2. 請問列表頁、內容頁、新增頁、儲存、編輯頁、更新、刪除的route分別怎麼寫? (以產品頁product為例)** ``` //列表頁 Route::get('product','ProductController@index'); //內容頁 Route::get('product/detail/{id}','ProductController@detail'); //新增頁 Route::get('product/create','ProductController@create'); //儲存 Route::post('product/store','ProductController@store'); //編輯頁 Route::get('product/edit/{id}','ProductController@edit'); //更新 Route::post('product/update/{id}','ProductController@update'); //刪除 Route::get('product/delete/{id}','ProductController@delete'); 目前使用get, 之後會用post ``` **3. 續上題,建立產品的migration, model, controller, view 指令/檔名分別為何?** ``` //migration php artisan make:migration create_products_table 路徑位置: database/migrations/ //model php artisan make:model Product 路徑位置: app/Product.php //controller php artisan make:controller ProductController 路徑位置: app/Http/Controllers/ProductController.php ``` **view** 無指令 :open_file_folder:建立product資料夾 路徑位置: resources/views/product > resources/views/product > > index.blade.php > > detail.blade.php > > create.blade.php > > edit.blade.php 資料夾共四個頁面. --- :::spoiler 前台+後台 #### 前台 > resources/views/front/product > > index.blade.php > > detail.blade.php #### 後台 > resources/views/admin/product > > create.blade.php > > edit.blade.php > > index.blade.php (後台的列表) ::: ###### tags: `課堂筆記` `yo`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up