Laravel Vue js project changes not working - laravel

I added two columns at the database table, also added those two columns at the model fillable attribute.
When I run a route to see the result. It's saying unknown column. Actually it exists at the database Table.
I am working on Laravel with Vue project.
Now am facing deployment issues.
First of all, when I uploaded the entire project to Cpanel from my local machine. Everything working properly.
But, when later I changed any query or other things it's not reflecting on the browser.
What I tried to solve this problem?
Step 1: Removed cache, views, routes
Step 2: npm run dev at the local machine and uploaded public/js/app.js from local machine project to Cpanel project public/js directory.
After upload app.js to the Cpanel public/js folder, I am running again the cache remove command. But there is no change reflection.
How I remove cache through the route below :
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 response error :
"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))",
Database structure :
How to deal with this problem?

The npm run watch command will continue running in your terminal and watch all relevant files for changes. Webpack will then automatically recompile your assets when it detects a change:
npm run watch

You need to watch your changes with the command npm run watch if you are not able to see your changes after compiling then it means your project front end is caching, you can specify the version of your compiled file from where you include it in your application. you can do it like this.
or do this so that you don't keep changing version very time you update

Related

Error thrown when attempting to install Magento on cPanel

As stated in title, when trying to install Magento through Installatron on cPanel it throws an error everytime saying:-
"A database query has failed. Is the entered database information correct? Does the account have available disk space?
Technical information:
method = query
arguments = array ( 0 => 'SELECT user_id FROM mg_admin_user WHERE is_active=\'1\' ORDER BY user_id ASC LIMIT 1', 1 => NULL, 2 => 'user_id',)"

Code Not Working For Old Users After Website Migration

We have a website vehicle search page and over a week ago we migrated to a new hosting provider.
All old users who are revisting and some select users don't see any results on our search however when utilising dd on the collection of products it shows the correct count however the list of results are not part of the collection.
If we use incognito or flush our dns, chrome cache and local cache we can see the results properly.
I can provide the code pieces in question if required, however wondering if anyone has had this issue before.
Thanks
We have done the following;
Flushed the cache and cookie via code in the controller
localstorage refresh with jquery
localsession refresh with jquery
updated all versions on style sheets and javascript to refresh them
ran composer update to see if that helps
Cleared every inch of cache via laravel commands on the server ,application cache, views, routes, configs
new key
change cache clearance in htaccess
changed from Public to no-store in htaccess
The following 3 worked however not ideal as we can't utilise this on customers machines;
Flushed chrome cache via browser
Flushed dns via cmd line
Icognito
This is the part of code that retrieves and makes up the collection;
$products = $this->product->search($data, $page->id, 24, $type, $userlatLon);
This function is the following;
public function search($data, $pageId, $productsPerPage, $type, $userlatLon)
{
if($pageId == 1536){
unset($data['images']);
}
$sortArray = self::sortArray();
$avaiableFilters = self::avaliableFiltersArray();
$types = self::determineTypeFromGivenInt($type);
$select = 'products.url, products.id, products.registration_date, products.created_at as in_stock_date, products.location_code, products.type, products.special_order, products.price, products.sale_price, products.make, products.model,
products.derivative, products.mileage, products.live_until, products.model_year, products.year, products.times_viewed_in_the_last_week, products.transmission, products.tax_cost, products.fuel_type, our_title, our_description, i.our_src_440, f.term, f.first_payment, f.id as finance_id,
no_of_regular_payments, monthy_payments, final_payment, cash_price, cash_deposit, engine_size_formatted, total_deposit, amount_of_credit, total_charge_for_credit, total_amount_payable, products.plus_vat, products.attention_grabber,
apr, l.friendly_name as location_name, l.url as location_url, l.gmaps_url as gmaps, l.address_1, l.town, l.city, l.postcode, l.telephone, if(sale_price > 0 AND sale_price < (price - 100) , 1 , 0) as reduced';
!!!MORE QUERYING IS HERE!!!
if ($type == 4) {
$products = $products->has('pdfRecord')->groupBy('products.make', 'products.model')->paginate($productsPerPage, ['products.url']);
} else {
$products = $products->groupBy('products.id')->paginate($productsPerPage, ['products.url']);
}
return $products;
}
The expected results should be all products showing like a normal user sees.
However the collection returns 648 results but non of the results are part of the collection

Laravel : How to delete Database Notification according to the data present in array of notification

I have followed this link to create database notification in my laravel ecommerce app , when buyer user send question to seller
my application successfully able to create database notification as follows
table : notifications
id | type | notifiable_id | notifiable_type | data | read_at | created_at | updated_at
id = 0b2a7fdf-eea4-4982-a86d-e874bb4f28ef
type = App\Notifications\BuyerQuestionNotification
notifiable_id= 48
data = {"message":"Someone asked question for Hostelfe","url":"#", "question_id":12024}
read_at = NULL
created_at = 2018-04-07 12:46:42
updated_at = 2018-04-07 12:46:42
now i want to delete database notification row by data->question_id
I have tried below query :
DB::table('notifications')
->where('type','App\Notifications\SellerAnswerNotification')
->where('data->question_id',2079107489)
->first();
got error :
[2019-03-31 13:22:03] local.ERROR: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>'$."question_id"' = ?' at line 1 (SQL: select * from notifications where type = App\Notifications\SellerAnswerNotification and data->'$."question_id"' = 2079107489)
I have also tried below query:
$result=DB::table('notifications')->whereRaw("JSON_EXTRACT(data, '$.question_id') = ?", [2079107489]);
But got similar error
How to correct the query to get row and delete row by json in notifications table?
Here you go, I tried this one and it worked:
DB::table('notifications')
->where('type','App\Notifications\BuyerQuestionNotification')
->where('data->question_id',12024)
->first();
NOTE: it will work only for MySQL 5.7.13 and later.
For further reading :
https://dev.mysql.com/doc/refman/5.7/en/json-search-functions.html#operator_json-inline-path
https://laravel.com/docs/5.8/queries#json-where-clauses
When you do json_decode($data) then try where($data['question_id'])

Strange query behavior oracle 11g

I have a query as:
SELECT ps_node_id,name
FROM cz_ps_nodes WHERE cz_ps_nodes.ps_node_type=261
START WITH NAME = 'Bundle Rule Repository',cz_ps_nodes.devl_project_id = P_devl_project_id AND cz_ps_nodes.deleted_flag = 0
CONNECT BY PRIOR ps_node_id = parent_id.
This query works.
But if I just remove the name from the select part like:
SELECT ps_node_id
FROM cz_ps_nodes WHERE cz_ps_nodes.ps_node_type = 261
START WITH NAME = 'Bundle Rule Repository',cz_ps_nodes.devl_project_id = P_devl_project_id AND cz_ps_nodes.deleted_flag = 0
CONNECT BY PRIOR ps_node_id = parent_id.
The query just hangs but was working on oracle 10 g and the problem started when we upgraded to oracle 11g.
Could anyone explain why?
Got the issue solved by using : alter session set optimizer_features_enable='10.2.0.4' –

500 - No valid database connection:MySQL server has gone away

I have a website under the joomla in one of the hosting servers. It was working fine until yesterday. But starting from yesterday when I open the web site it gives me following error:
500 - No valid database connection:MySQL server has gone away SQL=SELECT a.*, CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug, CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug FROM jos_content AS a INNER JOIN jos_categories AS cc ON cc.id = a.catid INNER JOIN jos_sections AS s ON s.id = a.sectionid WHERE a.state = 1 AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2012-03-04 17:59:41' ) AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2012-03-04 17:59:41' ) AND s.id > 0 AND a.access <= 0 AND cc.access <= 0 AND s.access <= 0 AND s.published = 1 AND cc.published = 1 ORDER BY a.created DESC LIMIT 0, 5
Or sometimes it just says :
Internal Server Error.
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#mysite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
What could be wrong with it? Or it is the host center who has a problem?
Change the database type from mysql to mysqli.

Resources