I have a google sheet like this. Those values are just place holders at the moment for my headers When I run my PHP script with $range = ‘Sheet!F2:L2’; to insert records into the google sheet via API/service account and I only want to start inserting at ROW F for all attempts, it inserts fine on t…
Installing pdo_sqlsrv driver in PHP 7.4 using CentOS 8
I have successfully installed php 7.4 with Remi packages in my CentOS 8 VPS (Used this guide https://www.digitalocean.com/community/tutorials/how-to-run-multiple-php-versions-on-one-server-using-apache-and-php-fpm-on-centos-8) I have a VirtualHost in my Apache server, that points to my domain and load the req…
Form data isn’t submitting to database in Laravel controller
In my home page in my Laravel project I have a modal which contains a form. <div class=&…
Php str_replace one by one in loop
I have a string like A name Tokyo 26, B name Moscov 45, C name Newyork 26, D name Berlin 67, E name Paris 37, F name London 39 I want to replace name words as name1 name2 name3…. so the final string …
Inserting data into a table using foreign keys in MySQL
I am trying to insert data into a contacts table using foreign keys in mysql, the structure of tables are as follows CONTACTS TABLE id contactname phone_number fk_id USERS TABLE pers_id …
how to append `request()->input()` to GET form action
I have a filtration page to get the posts according to user choices, I want to give the user the ability to choose multiple ways to filter, such as the price, post date, category, …etc. therefore I should append the user’s previous choices. for example ex: example.com?category=1 and now the user w…
Discount cart item price excluding a category and its children in WooCommerce
The fact is that the customer asks for a 50% discount for “Local Pickup” – I have already done this (I found a code here on StackOverFlow that applies a discount on all goods), but there is …
How to join relationships in Eloquent?
I’m stuck in a problem, I have these 3 models: Order, OrderItem and Product, each Order has many Order Items, and each Order Item has one Prduct but a Product can be ordered several times. Product has a supplier ID column (each supplier has many Products). So here are the relationships: Model: Order: Mo…
Laravel Sanctum returns 500 when trying to access sanctum protected API
I am using Laravel 8.12 with PostgreSQL. I am trying to use Laravel Sanctum as authentication for my API. This is the schema for sanctum: And this is my user table: Now, when I try to send the token in headers, I get this error: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for t…
Laravel use append attirbute inside a query in controller or scope
So I have done the following: I have a table called group that has longitude and latitude which is essentially a location of the group. Then I have an append which calculates the distance from the user. Group Model: What I want to do now is USE that distance from user in a where clause like below in a scope,