1. 設定時區及語言
//config/app.php
'timezone' => 'Asia/Taipei',
'locale' => 'zh_TW',
2. 修改預設Home path
//app/Providers/RouteServiceProvider.php
public const HOME = '/';
3. 打開namespace controllers功能
//app/Providers/RouteServiceProvider.php
protected $namespace = 'App\\Http\\Controllers';
打開後方便routes/web.php,直接可用@來引入,這樣不用在頂部再手動use引入文件
Route::get('/', 'PagesController@root')->name('root');
4. 建立一個常用的function file, 並全站式自動載入
add app/helpers.php edit composer.json
"autoload": {
"files": [
"app/helpers.php"
]
},
再執行指令
composer dump-autoload
以上是 Laravel 個人化常用設定,基本上安裝後都必定會做的
5. 補充一下安裝tailwindcss + css
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
npx tailwindcss init
tailwind.config.js
module.exports = {
purge: [
'./resources/**/*.blade.php',
'./resources/**/*.js',
],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}
webpack.mix.js
mix.js('resources/js/app.js', 'public/js')
.sass('resources/css/app.scss', 'public/css', {}, [
require("tailwindcss"),
]);
第5點不是大家常用的,但是這是我必需的