Questions tagged as 'php'

1
answer

Retrieving accents from a string with PHP

I'm using friendly urls and to generate the link, I'm using it this way: $string = $jm->NomeCategoria; // retorna roupa de verão $hifen = preg_replace('/[ -]+/' , '-' , $string); // incluo o hífen $acentos = preg_replace( '/['^~\'"]/', null...
asked by 20.10.2017 / 18:06
1
answer

Do not pull information only in index

Well, I'll try to explain as best I can, I know this can be simple but at the same time I do not know how I can do this ... Let's say that in my Header I have a 'bar' that I would like to appear on all the pages that I pull the LESS header in...
asked by 27.10.2017 / 15:45
1
answer

Error using POST in Laravel API

I'm learning how to build an API using Laravel 5.4. *. No Api.php : $this->get('products', 'API\ProductController@index', ['except' => [ 'create', 'edit' ]]); No Product.php : class Product extends Model { pro...
asked by 13.10.2017 / 21:00
1
answer

Extension of function in laravel

I'm using Laravel 5.3 and apparently I have a Controller calling the function: (new AnuncioRepository())->getListagemAnuncios() and the SQL for this is: return DB::select(' SELECT anuncio.id,...
asked by 04.01.2017 / 13:44
1
answer

How do I check credentials before logging in to Laravel 5.3?

My application uses Laravel's ready authentication, however I'm requiring users to log in to it from a webservice. So what I'm trying to do is that if the guy exists in the application database, he does Laravel's native authentication, if not...
asked by 11.01.2017 / 21:19
1
answer

How to validate at least one required field?

I have two fields CPF and CNPJ, the user must enter only one, but never leave both fields empty. This way it leaves the two fields mandatory: [ 'Cpf' => array('required'), 'Cnpj' => array('required'), ] Is there any way in Lar...
asked by 12.01.2017 / 14:14
3
answers

How to have security in id exposed in links - PHP + Javascript

PHP language. I have a grid where I have in each line edit buttons and delete that record with actions in javascript passing the id of that record to take the action. My problem is security related since it may have a sneaky user who changes...
asked by 12.01.2017 / 14:17
1
answer

Error handling PHP PDO

In PHP, how do you make the PDO not issue FATAL error so that it is possible to identify and handle the error that occurred? Example: Table: tb_pedidos: id fk_products qtd 1 5 5 2 7 2 3 2 13 Table: tb_products id description 5 Manga 7 Grap...
asked by 10.01.2017 / 21:20
1
answer

Add columns from a table to a total field and repeat the sum with each new row

I have a table with some columns for typing values and I need to add the total of these values in an end column. The sum is easy to do, however the table and dynamics are generated several lines, and when I try to add the columns again in the...
asked by 04.01.2017 / 12:37
1
answer

Input text returning bool (false)

I have this HTML code <!DOCTYPE html> <HTML> <HEAD> <TITLE>Cadastro</TITLE> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> </HEAD>...
asked by 13.12.2017 / 01:23