<input type="file" accept="image/png, image/jpeg" class="form-control" name="avatar">
<input type="file" accept="video/*" class="form-control" name="intro_video">
Monthly Archives: March 2021
Prevent Showing expired data when user click back on browser
Solution:
header("Pragma: no-cache");
header("cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
Reference:
Laravel Task Scheduling on Windows 10
- Open Computer Manager (電腦管理)
- Open Task Scheduler (工作排程器)
- Enter program path:
C:\php-7.4\php.exe
Options: D:\www\2019\Dev\artisan schedule:run - Setup execution time
Note: The start time is important, following execution time base on this.

Reference:
網站使用API存取資料問題
如果是同一個系統,如果把資料存取從controller->model改成controller->api 會有以下問題
- 增加額外的API開發及管理成本
- Debug難度變高
- 開發速度慢
- Guzzle及postman不支援.host檔的設定,所以不能用 example.test 之類的網址存取API
結論: 不要用API
env() helper doesn’t work sometimes
Save env variables in config and use config() helper to get the value.
return [
'env' => env('APP_ENV'),
];
echo config('wikirex.env');
https://laracasts.com/discuss/channels/general-discussion/env-not-reading-variables-sometimes
Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 7.3.0”
Add a line in composer.json
"platform-check": false
Execute composer update
Reference:
migrate not work
Error
Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found
Solution
- Change version of “doctrine/dbal” to “^2.0”
“doctrine/dbal”: “^2.0”, - composer update
Eloquent’s save() is not working
Following script will save nothing:
$member = MemberM::where('id', auth::id())
->select(
"name",
"email",
"phone",
"county",
"district",
"address",
"verified",
'registered'
)
->first();
$member->registered = 0;
$member->save();
Reason:
Because no primary column in select(), adding “id” column will save this problem.