Laravel 如何解決大型網站時route文件過大的問題?將route文件分拆!

這篇文章我們先不討論用子域名分伺服來建立多個 Laravel 的可能 我們先不討論效率是否會加強或改善,只討論`方便管理` 因為網頁而言,大多數是用`routes/web.php`, 所以網網站變得架構很複雜很大的時候,你這個文...

2022-02-06
Read more

Laravel redirect()->route 傳值(set value)的幾種方法

## 常用的 redirect()->route ```php //demo, route不帶任何value return redirect()->route("topic.list"); //demo, 某些頁面一定要帶上$id return redirect()->route("topic.edit", $id); //demo, 帶上flash mes...

2022-01-04
Read more

Laravel old value 在新增頁面時如何保留?

#### 1. 一般情況下可用 ```php ``` #### 2. 如果沒有$data呢? 但這個情況只能在edit 頁面做,但在create page時,你本身沒有資料,所以被 `redirect->back()` 時是沒有任何資料 ```php //demo: return back()-...

2022-01-03
Read more

wordpress litespeed cache 排除不執行lazy load 指定images

litespeed server針對wordpress速度大大提升 但是如果用戶在網絡連線不順時,會顯示個灰色的正方框 loading 圖片,因為wordpress Litespeed 插件預設了全站網站都用lazy load,但在某些位置以lazy load方式顯示不太...

2021-12-23
Read more

Select2 替代品 (非JQuery的套件)

### 為什麼要離開始Select2 Select2一直都很好用,用了很久,但某些項目中不能用到jquery,就無法使用了 ### Tom Select > https://github.com/orchidjs/tom-select 基於 selectize.js 改出來的,selectize.js是需...

2021-12-03
Read more

Laravel File System

## 1. 基本設定 config/filesystems.php 新增一個disk ```php 'temp' => [ 'driver' => 'local', 'root' => storage_path('temp'), 'url' => env('APP_URL') . '/temp', 'visibility' => 'public', ], //在...

2021-11-17
Read more

又遇上了strict-origin-when-cross-origin

不適用所有人,但我數個project都解決了 我大部分project都是把網站跟附件/圖片分2個server來存放東西 的確Chrome在某個版本,大家都說是Chrome85 開始,對於跨站上傳有很多影響 有些說`strict-origin-when-cros...

2021-11-16
Read more

Laravel many to many 之 Tags系統

Tags 系統、好友系統等等 凡是需要多一張中間表出來做關聯記錄的,都能參考 ```html //簡易架構解釋 model Posts:: model Tags:: Table 1 : posts id title Table 2 : tags id name Table 3 : tags_rel id -...

2021-11-15
Read more

Laravel 如何快速判斷是否當前位置?

其實在blade文件中可這樣做判斷 ```php @if(Route::currentRouteName() == "user") class="active" @endif ``` 但如果是情況更複雜的,比如是 你 user.index. user.edit. user.create 都需要active等等?...

2021-11-14
Read more

Laravel安裝後常用的基本設定

### 1. 設定時區及語言 ```php //config/app.php 'timezone' => 'Asia/Taipei', 'locale' => 'zh_TW', ``` ### 2. 修改預設Home path ```php //app/Providers/RouteServiceProvider.php public const HOME...

2021-11-13
Read more
Recommended topics
Technology