Category "php"

PHP using str_starts_with for array to exclude same as with wildcard

This is my ignore list which i have some item that i don't into that $ignoreRoutes = [ 'administrator', 'attachImage', 'login', 'logout', 'l

Laravel: Schedule a job or an artisan command?

I have a Product model with id,name,price. The price value is stored in an external API and i need to fetch it every minute in order to update it in the databas

Laravel 5.5 file_put_contents permissions issue

I have a new Laravel project, with Passport and basic authentication installed, and I am getting this error when I try to call the built in /api/register endpo

Get Header Authorization value of a login api (sent with username and password in json body) using php curl

I am writing a code in PHP where i need to call and API (Sending username and password) and then fetch the authorization value. I tried some solutions which are

Wordpress wpdb->delete issue

I'm trying to delete a record from the database programmatically. When I have it hardcoded like this it does delete a record from the database: $wpdb->delet

Laravel unique validation on multiple columns

I have 2 columns in table servers. I have columns ip and hostname. I have validation: 'data.ip' => ['required', 'unique:servers,ip,'.$this->id] This

Currently Using CodeIgniter Framework i have an Error

A PHP Error was encountered Severity: Notice Message: Undefined property: Login::$U_Model Filename: controllers/Login.php Line Number: 24

Find the "bad control character" that json_decode fails on in PHP?

I have a lot of JSON strings that are 25-50Kb each. I convert these to arrays with json_decode() and it works fine almost every time... But now I have ran into

Change the alert text on add to cart action without selected variation in Woocommerce

in Wordpress I'm using Woocommerce v3.3.5 and in single product pages for variable products, When I click the add to cart button while I don't select a variatio

What's the difference between `retry_after` and `timeout` options for Laravel queues?

I came across an issue in my code base where a job was being terminated early while its timeout was set to 540 seconds. However after looking in the documentati

Prevent blank space in pdf pages (DomPdf)

I don't want to leave blank spaces or leave only the minimum possible in pdf. I noticed that the tag is only inserted on the page when all its content fits on t

Check if user online laravel

I have column last_activity, where write date last activity user with middleware. How I can check online user and when he logout? Middleware: class LastActivi

Cannot retrieve order_id from database with SQL query

We are trying to update WC orders based on an external script. However, the script is unable to acquire the order_id for some reason. I tried to run the SQL que

sqlsrv_num_rows resule Warning: sqlsrv_num_rows() expects parameter 1 to be resource, boolean give [duplicate]

$results = sqlsrv_query($dbconn, $query2, array(), array('Scrollable' => 'static')); if (sqlsrv_num_rows($results) >= 2) { $query3 =

(PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()

firstly I was receiving a warning and a fatal error. The warning: Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue

Get WooCommerce product variation attribute terms in admin products general box

I display the id and sku of each variable product in the general tab - of the wp admin product data box with the following code. Any idea how to get the the var

Not able to access model in the controller mautic

Not able to access new model in the controller in mautic Mautic uses Symfony 2.x framework Steps taken: created entity extending CommonEntity created reposit

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

I'm trying to get composer to work on a remote Windows-machine which is using a proxy, but I always get this error when doing a composer install/update: [Compo

WordPress - Dynamically add user ID to the end of a URL

I'm looking for a way to have the current logged in username added to the end of a link. example: www.mywebsite.com/custom-post-type/author-post-title "author-

Display Brand Name Above Product Title in Woocommerce Cart, Checkout Page, Orders and Email Notification

Using the functions below I've applied a custom field to products added in Woocommerce cart and checkout page also to orders and notification email. My questi