Posts by David Santos • 528 points
24 posts
-
1
votes1
answer97
viewsQ: Add values from a table when the client is the same
Look at the table below, the final result should be this: I wonder how do I make so that only the last record of the client in the table displays the total amount of checks. I am using PHP (Laravel…
-
1
votes4
answers7452
viewsA: Formatting date with Laravel
Following the documentation of Laravel https://laravel.com/docs/5.4/eloquent-mutators#date-mutators Change this: protected $dates = ['data'=> 'm-d-Y']; To: protected $dates = [ 'data' ]; And add…
-
1
votes1
answer105
viewsA: Select columns in different tables
Your select does not need to pass the names of the columns you have in the address table, in this case you are passing the column rua and there is no need. Remove it from select and call the object…
-
-1
votes3
answers268
viewsA: Select postgres between two values
I ended up solving my situation, I found in the English Stack at this link https://stackoverflow.com/questions/38467298/how-to-correctly-use-fetch-first-in-postgresql I resolved it this way: SELECT…
-
1
votes3
answers268
viewsQ: Select postgres between two values
I am developing a system and I need to perform a select to fetch the % rate a customer will have. First I check what % of this customer’s cheque refund and look in another table what the predefined…
-
0
votes2
answers434
viewsA: Remove Orange Result Quotes 5.4
Use the function explode of PHP: $string = "2,1"; $array = explode(",", $string); the result will be: Array ( [0] => 2 [1] => 1 )…
-
2
votes1
answer273
viewsA: Foreach with two bd lists. Laravel Street
You can use it this way, I believe it will work for your situation: <table> <thead> <tr> <th>coluna1P</th> <th>coluna2P</th> <th>coluna1C</th>…
-
0
votes2
answers49
viewsA: How to perform a query of a query stored in a string through the DB class?
You can use the method whereRaw() of Facade, it would look something like this: \DB::table("users")->whereRaw("FIND_IN_SET(KillCount, (SELECT GROUP_CONCAT(KillCount ORDER BY KillCount DESC) FROM…
-
2
votes1
answer287
viewsA: Pass a php array in a query and return multiple results
I believe you should change the query to perform only one query and bring all the results you need. Another detail is missing the name of the column there on Where, but I will consider that you…
-
0
votes2
answers1365
viewsA: Consulta Laravel Eloquent
You can try to use it as follows: Model::select('id', 'deviceid', 'devicetime', 'latitude', 'longitude') ->whereIn('deviceid', [1, 2]) ->groupBy('id', 'deviceid', 'devicetime', 'latitude',…
laravel-eloquentanswered David Santos 528 -
0
votes1
answer154
viewsA: Custom Request does not redirect Laravel 5.4
One detail I hadn’t mentioned (because I didn’t think it would be related) was that I was using the Whoops by the Laravel 5.4. Somehow Whoops changed the default return behavior of Laravel when…
-
0
votes1
answer154
viewsQ: Custom Request does not redirect Laravel 5.4
I am implementing a system and realized the creation of a request through the command: php artisan make:request PreventivaRequest I put my rules in Request: <?php namespace…
-
1
votes1
answer1290
viewsA: Help with php_printer.dll
The php_printer extension is the standard way to get the printers connected to the server. But it will not identify network printers that are not configured on the server because it does not allow…
-
2
votes2
answers82
viewsA: Search in two tables
I believe you need to make one JOIN with the table ayzac_midia in the second SELECT and this way you can return the name of midia. Something like this: $sql = "SELECT ayzac_midia_name,ayzac_midia_id…
-
-3
votes3
answers252
viewsQ: Group and add PHP dynamic arrays
I am creating a shopping cart and save the product id’s in the session as follows: array( 636 => 1, 637 => 2 ); Where the 636 and 637 refer to the product ID and the value would be the…
-
0
votes2
answers362
viewsA: model and controller in codeigniter for making Insert in Firebird using Generator
I also work with Codeigniter and Firebird and the way I found to solve this situation is to create a method in the model that returns the last Generator: public function pega_prox_id() { return…
-
-3
votes1
answer1196
viewsQ: Update button data of a query without refresh on the page
I am creating an application in PHP (Codeigniter) and I came across the following situation. I have a table on my page that brings all the results of a query in the database. I want to create a…
-
2
votes4
answers25607
viewsQ: Load page and scroll automatically to a particular element
On a contact page there is in respective order: a banner, map and form. How can I make sure that when loading the page is automatically scrolled down leaving the beginning of it from the map?…
-
1
votes1
answer122
viewsQ: Codeigniter redirection
I developed an application in Codeigniter 3 at the company where I work and need to replace an old one. The situation is that the url address will be changed but we can not disable once the previous…
-
0
votes2
answers715
viewsQ: Codeigniter + Autocomplete Jquery UI does not return list
Good afternoon, everyone, I have a search field where I give "suggestions" of what to type, based on what I have registered in my database. The same was working perfectly, but it stopped working and…
-
1
votes1
answer2283
viewsQ: How to turn an integer into decimal?
I need a function to do the following, I get the number for example 15, and I need to turn it into a decimal 1.0, rounding the 5 to 0. I tried to use the number_format(15, 1, '.', ''), but he…
-
1
votes1
answer874
viewsQ: Sending email with Codeigniter using Gmail
I am trying to make a form to send email but I get the following error: A PHP Error was encountered Severity: Warning Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465…
codeigniterasked David Santos 528 -
4
votes1
answer3410
viewsA: API in Laravel receive POST JSON and write to database
I managed to solve it this way: public function saveConversion() { $input = file_get_contents('php://input'); // Pega todos os dados do json $jsonDecode = json_decode($input); // Decodifica o json e…
laravelanswered David Santos 528 -
4
votes1
answer3410
viewsQ: API in Laravel receive POST JSON and write to database
I will receive through the API a JSON with this structure: {"leads": [{"id":"1", "email":"[email protected]", "name":"Bruno Ghisi", "company":"Resultados Digitais", "job_title":"IT",…
laravelasked David Santos 528