Category "php"

Substraction in woocommerce

my problem is as follows. I am currently generating a tax receipt for some orders (not all) in my woocommerce. but the customer would like for 3 of the 4 produc

Dialogflow V2 API - How to pass context and/or payload

I am trying to send context and payload to the Dialogflow V2 API. I am able to successfully send a queryString and get a response from my agent. However, I need

If $_POST is empty Multiple function

I have the following $_POST function to check if the fields of 'start', 'middle' and 'end' is empty or not. if(!empty($_POST['start'])) { $description = "a

Why does Laravel say that my "update" method is not a support route?

I am getting this error when I try to use update method from my routes. The UPDATE method is not supported for this route. Supported methods: GET, HEAD, POST, D

Search in a non-existing table - relationship

I try to make hasMany relationship in Laravel and I have this problem. If I rename table name in Model to test, relationship works fine, seraching by my new tab

json_encode fails because of Unknown charactar

I have this array : [responses] => Array ( [0] => Array (

PHP8 - SplFixedArray iterator's next() doesn't move key pointer

Please take a look at this code: <?php $array = new SplFixedArray(1); print "\nKey1: " . $array->getIterator()->key(); $array->setSize(5);

VS Code - does not recognize php 8 syntax

I have recently set up vsCode with PHP. However, it shows errors on following lines. public static function myFunction(): bool|string error : syntax error, un

how to send error emails to the developer in laravel 8 App

I am using laravel "laravel/framework": "^8.75" version. When deployed the app turn APP_DEBUG=false but users get errors but they can not know what is wrong and

Target class controller does not exist - Laravel 8

Here is my controller: <?php namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; use Illuminate\Http\Request; class RegisterControlle

Admin login don't redirect to panel

I import a project on my local but I don’t have an access to the admin panel. I enter the right id/password, but after this, it's redirect me to

How to convert a json response into a callable object in php?

I'm trying to convert the json response below in $response variable to a callable function like $response->getStatus() so it can return failed. Here's the re

Laravel sanctum vue spa being blocked when using ip address

I know a lot has been documented on about laravel sanctum configuration to avoid blocked requests from your spa frontend, but something that is not quite clear

Laravel 9 on PHP 8.1 slow responses - out of the box

I am using out of the box Laravel 9 / php 8.1 combo and loading initial page for 190ms sounds horrible. Last project I built used laravel7 and the response time

php Keeping only 1 date occurence in multi-dimensional array

I have this array with certain brand_ids, within these brands I have an array of dates in which a sale occured but these are based on the products in sale so th

Contact Form 7 & Flamingo - Getting Flamingo Post ID as a Mail tag

On a WordPress website I'm using Contact Form 7 and Flamingo to manage contact forms, and store the data. I've been using [_serial_number] in my emails to ident

php code to execute mysql pivot table statement

below is mysql code that creates for me a pivot table in mysql. i have tried to run it in php but it doesn't work. how can i execute the code in php so that i c

Laravel cache error: Too few arguments to function {closure}(), 0 passed in .../Illuminate/Cache/Repository.php on line 426 and exactly 2 expected

So I have a table called styles which has classes and styles for various places in blade templates. The table has a unique column the name and a column for clas

Facing an issue while displaying a stored data in a .txt file into my bootstrap card

I have a simple issue in my PHP project I made a small application that gives you the possibility to fill the form fields and stored all the data inside a .txt

"The GET method is not supported for this route. Supported methods: POST ."

I'm trying to add a new Post but whenever i submit i get the above error message. This is Route: Route::get('/p/create' , [App\Http\Controllers\PostsController: