Laravel/Jetstream 試用

https://jetstream.laravel.com

composer create-project laravel/laravel test01

git commit laravel installed.

設定 .env 數據庫資料

composer require laravel/jetstream
php artisan jetstream:install livewire
npm i
npm run watch
php artisan migrate
>>>>>>
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table (514.13ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table (371.27ms)
Migrating: 2014_10_12_200000_add_two_factor_columns_to_users_table
Migrated:  2014_10_12_200000_add_two_factor_columns_to_users_table (137.08ms)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated:  2019_08_19_000000_create_failed_jobs_table (718.82ms)
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated:  2019_12_14_000001_create_personal_access_tokens_table (723.00ms)
Migrating: 2021_11_11_150317_create_sessions_table
Migrated:  2021_11_11_150317_create_sessions_table (1,429.71ms)
php artisan serve

go : http://127.0.0.1:8000

已可使用做到基本功能,註冊、登入、修改密碼、修改用戶名...

甚至基於google authenticator 的Two Factor Authentication,都已整合完成,可即時使用,給用戶感覺會很專業?不過要小安排一個方法處理萬一用戶失去了自己google authenticator或者手機不見了的後果

git commit jetstream base installed.

將jetstream 的相關View文件都publish出來以便修改

php artisan vendor:publish --tag=jetstream-views

全都集中在 /resources/views/vendor/jetstream/

官方文檔顯示以下的3個文件可更改svg logo

  1. resources/views/vendor/jetstream/components/application-logo.blade.php,
  2. resources/views/vendor/jetstream/components/authentication-card-logo.blade.php,
  3. resources/views/vendor/jetstream/components/application-mark.blade.php

注:我多次commit git,就是方便自己看到安裝新package或publish 文件出來時,有什麼新文件改動

Jetstream其中一點貌似是把session 由file save 改為database save.

config/jetstream.php 找到以下段落可控制部分功能的開關

    'features' => [
        // Features::termsAndPrivacyPolicy(),
        // Features::profilePhotos(),
        // Features::api(),
        // Features::teams(['invitations' => true]),
        Features::accountDeletion(),
    ],