Category "php"

How to Install Composer Require doctrine/dbal

In the Laravel framework, I am trying to modify my columns using change() by migrations. Right now, I need to install... composer require doctrine/dbal I am

Laravel 5 issue with wherePivot

I am working with Laravel 5 and I am having issue getting ->wherePivot() to work on a Many-to-Many relationship. When I dd() the SQL it looks like Eloquent i

Custom add to cart button URL for specific product in WooCommerce?

I would like the user to be directed to a certain URL when they click the 'add to cart' button. At the moment I have this: /** * Set a custom add to cart URL

Adding reCAPTCHA v2 into my PHP file

The PHP problem has been solved. Here are the HTML and PHP codes that I'm using: contact_form.html: <html> <head> <title>My Contact Form

Composer Script echo

What is the best way to echo to the console in a composer.json script? For example, I have used the scripts section to create a custom installer and at the end

PHP: Print caught exception like Xdebug

I have a PHP function which I call when I caught an exception. It accepts that exception as optional parameter, so it can show it for debugging purposes: publi

Laravel excel maatwebsite 3.1 import, date column in excel cell returns as unknown format number. How to solve this?

By using Maatwebsite/Laravel-Excel version 3.1 to import excel sheet, here I faced an issue date time column of the excel sheet returns unknown number. How to s

Combine multiple columns into an array as one of the key in a results set

I am having trouble placing data into its right structure. I have a result set data of: array ( 0 => array ( 'company_id' => 1, 'company_ab

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

From PHP I would like to call a stored procedure in MySQL. The procedure takes input and output parameters -- not "INOUT" parameters. For a simple example, sa

Laravel implode array items to new lines

Here is my array from hasMany relationship in Laravel framework. $array = ['php','css','hrml']; How can I display as below using implode function. (code in m

Nginx disallowing execution of PHP in uploads directory with Magento

I'm having difficulties getting nginx to stop execution of PHP in an uploads directory on a magento install. I've tried many combinations of directives that sh

How to Make Laravel Eloquent "IN" Query?

I want to make query in Laravel Eloquent like here its raw MySQL query SELECT * from exampleTbl where id in(1,2,3,4) I have tried this in Laravel Eloquent

MongoDB Duplicate Documents even after adding unique key

I have created a collection and added a unique key like this db.user_services.createIndex({"uid":1 , "sid": 1},{unique:true,dropDups: true}) The collection

Add Metadata, headers (Expires, CacheControl) to a file uploaded to Amazon S3 using the Laravel 5.0 Storage facade

I am trying to find out how to add in Metadata or headers (Expires, CacheControl etc.) to a file uploaded using the Laravel 5.0 Storage facade. I have use the p

Hide specific products from unlogged users based in product category in WooCommerce

I have a certain product category that I only want to offer to logged in users. How would I implement that? So how to hide specific products from unlogged user

PHP array stringify

In a lyrics application I'm coding, I'm using an array to print an artists table. The artists array looks like this: $artists = [ [ "Avril Lavigne"

Laravel lang slug in url

I've followed this article to add multi language into my app and it's working fine, the only issue i need to solve is that languages slug won't add to the url.

Laravel IOC Binding Question - getting 500 error

I keep gettings a 500 errors, appdebug = true, but it doesn't show me exactly what the problem is. It logs all other 500 just fine. I can make the 500 errors go

Why am I getting this FedEx API error 'The given grant_type is not supported. Please modify your request and try again'

I'm using this PHP code: $service_url = 'https://apis-sandbox.fedex.com/oauth/token'; $curl = curl_init($service_url); $curl_post_data = array( "co

Lost connection to MySQL server during query In codeigniter query ,Live site

I'm getting the following error on my live site. "Error Number: 2013 Lost connection to MySQL server during query" It was working fine before a day but now the