【问题标题】:Laravel Vue js project changes not workingLaravel Vue js项目更改不起作用
【发布时间】:2020-12-28 09:38:56
【问题描述】:

我在数据库表中添加了两列,也在模型可填充属性中添加了这两列。


当我运行一条路线以查看结果时。它说未知列。实际上它存在于数据库表中。

我正在使用 Vue 项目开发 Laravel。 现在面临部署问题。 首先,当我将整个项目从本地机器上传到 Cpanel 时。一切正常。

但是,当我后来更改任何查询或其他内容时,它并没有反映在浏览器上。

我试图解决这个问题是什么? 第 1 步:删除缓存、视图、路由 第二步:在本机npm run dev,将本机项目中的public/js/app.js上传到Cpanel项目的public/js目录中。

将 app.js 上传到 Cpanel public/js 文件夹后,我再次运行缓存删除命令。但是没有变化反映。

我如何通过以下路线删除缓存:

use Illuminate\Support\Facades\Artisan;

Route::get("reboot",function (){
   Artisan::call('config:cache');
   Artisan::call('route:clear');
   Artisan::call('view:clear');
   Artisan::call('cache:clear');
   dd("Ready to Re-start");
});

API 响应错误:

 "message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'start_timestamp' in 'where clause' (SQL: select count(*) as aggregate from `vehicle_prices` where `rental_duration_id` = 5 and `rate` between 0 and 55 and exists (select * from `vehicles` where `vehicle_prices`.`vehicle_id` = `vehicles`.`id` and exists (select * from `users` where `vehicles`.`partner_id` = `users`.`id` and `is_vehicle_release` = 1 and `status` = 1) and `service_id` = 1 and `status` = 1 and `passenger` >= 1 and `bag` >= 1 and exists (select * from `vehicle_cities` where `vehicles`.`id` = `vehicle_cities`.`vehicle_id` and (`country` = BD and `locality` = Dhaka or `additional_locality_1` = Dhaka or `additional_locality_2` = Dhaka or `additional_locality_3` = Dhaka or `additional_locality_4` = Dhaka) and `vehicle_cities`.`deleted_at` is null) and not exists (select * from `reservations` where `vehicles`.`id` = `reservations`.`vehicle_id` and ((`start_timestamp` between 2020-09-11 04:00:00 and 2020-09-11 08:43:00 or `end_timestamp` between 2020-09-11 04:00:00 and 2020-09-11 08:43:00) or (`start_timestamp` <= 2020-09-11 08:43:00 and `end_timestamp` >= 2020-09-11 04:00:00))) and `vehicles`.`deleted_at` is null) and exists (select * from `vehicles` where `vehicle_prices`.`vehicle_id` = `vehicles`.`id` and `vehicles`.`deleted_at` is null))",

数据库结构:

如何处理这个问题?

【问题讨论】:

  • 你有没有试过给表加别名,你的问题好像是列不明确。

标签: laravel laravel-vue


【解决方案1】:

npm run watch 命令将继续在您的终端中运行并监视所有相关文件的更改。然后,Webpack 会在检测到更改时自动重新编译您的资产:

npm 运行观察

【讨论】:

    【解决方案2】:

    如果编译后看不到更改,则需要使用命令 npm run watch 观察更改,这意味着您的项目前端正在缓存,您可以指定包含它的编译文件的版本在您的应用程序中。你可以这样做。

    或者这样做,这样您就不会在更新时不断更改版本

    【讨论】:

      猜你喜欢
      • 2021-12-24
      • 1970-01-01
      • 2018-12-09
      • 2021-06-02
      • 2021-07-18
      • 2016-01-16
      • 1970-01-01
      • 1970-01-01
      • 2020-07-22
      相关资源
      最近更新 更多