Questions tagged as 'php'

1
answer

How to change the default name of an eloquent column

I'm in a project that is in production, and by default when we use a foreign key in eloquent we follow the following rule "user_id" for example to store the user id. Only in the database that I'm working with, they put this field as " id_u...
asked by 20.06.2017 / 14:01
2
answers

Combobox of 5-minute intervals with PHP

Colleagues. I have a combobox where I want to store schedules from 07:00 to 22:00 with a 5 minute interval. See below: HowdoIdothisinPHP?UnfortunatelyIdonothaveanycodereadyinPHP,becauseIdidnotfindalogic.<divclass="input-group" style="w...
asked by 22.06.2017 / 18:26
1
answer

Get all the dates of a day of the week

I have a code that takes all dates on a certain day of the week. Ex. 5/06/2017 = Monday. The code is working perfectly. More is limited only 1 day of the week, I would like to "spend" more days an array. function dias($dia_semana, $mes,...
asked by 22.06.2017 / 19:12
1
answer

Calculate percentage MySQL

I want to do a percentage calculation. Taking the value that was received in that selected month (received = 1), divide by the total value of that selected month, and multiply by 100 to return the percentage. The logic I used below is working pe...
asked by 18.06.2017 / 14:15
3
answers

List Folder Files with PHP

I was looking for this solution, where I can browse the server and show folders and files, without resorting to DB. This seems interesting to me, but how can I show all files without the first 2 (.) (..) Thisiswhathappenstome,whatIwantistosh...
asked by 21.06.2017 / 17:58
1
answer

"mysqli_connect" does not work

I can not use the "mysqli_connect" function. Can someone help me? You are returning the following error:    Fatal error: Constant expression contains invalid operations in   /home/vagrant/Projects/products/app/Database/Connection.php on line...
asked by 06.05.2017 / 17:00
1
answer

How to identify if a request uses HTTPS?

I have to identify if the system that is sending us a request is HTTPS. if ($isHTTPS){ #faça alguma coisa } else{ #faça outracoisa }     
asked by 05.05.2017 / 18:38
2
answers

Error "Content-Type is not allowed by Access-Control-Allow-Headers in preflight response"

I'm doing my api, in php, and I get the following warning    XMLHttpRequest can not load link . Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response. Here is the beginning of my php code:...
asked by 08.05.2017 / 21:25
1
answer

How to block access on a page by url [closed]

I need to block the access of a page in Php directly accessed by the url     
asked by 08.05.2017 / 06:31
1
answer

Check route with variable in Laravel 5.1

I'm using the code below to assign the "active" class when on the "product" or "product / create" route. <li {!! Request::is('produto', 'produto/create')? 'class="active"' : null !!}> Now I need to do the same in the product edition,...
asked by 08.05.2017 / 16:29