I want change the default timezone from UTC to Asia/Tehran where I can change it? I tried by changing this code in app.php but it did not work.

'timezone' => 'UTC',

to

'timezone' => 'Asia/Tehran',

推荐答案

更新应用程序后.php在下面运行命令并判断

php artisan config:cache
php artisan cache:clear

You can create below type of route for clear cache in laravel

Route::get('/clear-cache', function() {

    $configCache = Artisan::call('config:cache');
    $clearCache = Artisan::call('cache:clear');
    // return what you want
});

Laravel相关问答推荐

从8.0更新到10.0后,图像不再上传到存储

运行Docker时,安装PHP8.1时返回错误

调用字符串上的成员函数

使用 App::environment() 与 app()->environment() 与 config('app.env') 之间的区别

Laravel 5 如何配置 Queue 数据库驱动程序以连接到非默认数据库?

安卓 retrofit |发布自定义对象(将 json 发送到服务器)

Laravel transformer vs resource

如何比较laravel中的两个加密(bcrypt)密码

Laravel 5 - 在控制器文件中为多个路由定义中间件

Eloquent 的 Model::query() 是什么意思?

将 Laravel .env 变量添加到 Vue 组件

Laravel Artisan CLI 安全地停止守护进程队列工作者

用于集合的 Laravel 5.5 API 资源

Laravel 和 PHPStorm 项目的 gitignore 中包含什么?

如果值存在于另一个字段数组中,Laravel 验证规则

Laravel / Eloquent内存泄漏重复检索相同的记录

如何在 Laravel Mix 中将公共路径更改为包含下划线的内容?

使用哪个 Auth::check() 或 Auth::user() - Laravel 5.1?

如何获取 Laravel 块的返回值?

Laravel 手动登录功能