Posts by Erlon Charles • 5,352 points
161 posts
-
0
votes1
answer25
viewsA: How to remove duplicate elements in a multidimensional matrix
You can turn your array in a Collection and use the methods groupBy and map $users = collect($array)->groupBy('Nome')->map(static function($users) { return $users->last(); }); It is also…
-
0
votes1
answer198
viewsA: Version control Rest with Laravel
What it means to see an Apirestful ? Imagine the following situation, you are developing an API that will be consumed by an application developed for IOS/Android, one of the endpoints of your API…
-
5
votes1
answer51
viewsQ: How to wait for a user action on a Job?
The Situation Having a service queue, where whenever a user enters the queue he receives a position number in the queue, I need to request the presence of the first of the queue. If the first row…
-
1
votes1
answer43
viewsA: Clear city variable when selecting another state
I don’t recommend bringing the first selected city, this may induce the user to the error of selecting an unwanted city, so leave a "Select a city" option" (selected) and as not selectable…
-
0
votes1
answer260
viewsA: I want to edit a pdf contract using PHP, or JS, or any web solution that serves
You will need to develop the PDF template in HTML, then save it to PDF. There is a plug-in for the wysiwyg editor Tinymce that converts html to a pdf…
-
1
votes1
answer273
viewsA: Trying to get the 'id' property of non-imposition with Array
The most recommended way to ensure that you will not have one $provider['object'] null is placing a check before the assembly of the provider $user = User::find($p->provider); if($provider ==…
-
0
votes1
answer212
viewsA: Message "Undefined index" when Checkbox is empty - php/html
You should check whether $_POST['cb'] exists and not $check_B <?php if(isset($_POST['cb'])){ $check_B = $_POST['cb']; echo "Checkbox selecionado."; } else { echo "Checkbox não selecionado."; }…
phpanswered Erlon Charles 5,352 -
0
votes1
answer676
viewsA: compare bank date with current date LARAVEL
@Bruno, first of all compare these dates on controller and just pass to the view what you need already compared. The way you are doing this screen can take quite a while to render, if you have…
laravelanswered Erlon Charles 5,352 -
-1
votes3
answers647
viewsA: Storing latitude and longitude Laravel
According to these definitions, we have the following description of the accuracy of the decimal places of latitude and longitude: The digit of unit (a decimal degree) gives the position up to 111…
laravelanswered Erlon Charles 5,352 -
0
votes1
answer237
viewsA: Recover session by sessionStorage
You need to set the data that is currently in the php in the sessionstorage sessionStorage.setItem('usuario', '<?php echo $_SESSION['usuario']?>'); After that you can take user data with var…
phpanswered Erlon Charles 5,352 -
1
votes1
answer244
viewsA: Inner Join Laravel - Erro Where clause is ambiguous (23000)
Your Select works because there is no clause Where. If you put a where colaborador_id = 1 in the query running in the database, you will get the same error. This happens because both tables have…
-
0
votes2
answers296
viewsA: Bring data and save to a variable in Controller - Laravel API
I took the opportunity to make a syntax improvement in your code, leaving more standardized. You already have the result of your search on $query->paginate($request->get('limit')) but if you…
-
1
votes1
answer75
viewsA: Error creating folder in PHP
So that the php can perform file and directory creation actions, so make sure your folder /var/www/meusite.com.br/ has permission for the group www-data. Set this permission with the command: sudo…
-
1
votes1
answer1607
viewsA: Undefined Property: stdClass
First of all, I recommend you use the foreach instead of a for() to iterate an array. (even if you lose a little performance, it makes reading much easier) There is the possibility of some of the…
-
4
votes1
answer39
viewsA: Why Between doesn’t bring the right answer
Are you making a wrong use of between. between serves to check if a value is between 2 values. Example select * from numeros where valor between 0 and 10 The return of the select above would be…
-
1
votes3
answers973
viewsA: Laravel - validation of the field formatted with BR currency
The best option in this structure you are sending is to simply replace the characters before validation with str_replace() $fields = $request->all(); $fields['valorTotal'] = str_replace(['.',…
-
2
votes1
answer393
viewsA: Take a variable from the url, pass method get Laravel
You can import the class Illuminate\Http\Request in his controller and uses it in its method to receive the data passed by the request to your controller, by route: use Illuminate\Http\Request;…
-
1
votes1
answer365
viewsA: How to pass form parameter for an Laravel route in an API?
According to her own documentation of the Laravel To generate a url by running parameters using the helper action(), you must pass on the second helper argument a array with the parameters you want…
-
1
votes1
answer148
viewsA: PDF attached in encrypted email arrives
The method $pdf->output() generates the binary content of the PDF file, but the method attach() needs a physical file to be sent, so I recommend saving this content temporarily:…
-
3
votes2
answers234
viewsA: Is it possible for a domain to block a query via Curl?
Using the header Access-Control-Allow-Methods you can define what type of request can be made to a file (or route) on your source server. So if you want to allow only requests of the type GET for…
-
4
votes1
answer46
viewsA: Can someone help me get on board?
A good way to ensure width and alignment of the items is the use of inline-grid, in its case, the use shall be attached to the definition of the width of the element, i.e. width:20px and the…
-
-1
votes1
answer74
viewsA: PHP Take a phrase value from within the array
You can make a runtime calculation using the microtime() <?php function ping($host, $port = 80, $timeout = 10) { $tB = microtime(true); // inicia um valor de timestamp $fP = fSockOpen($host,…
phpanswered Erlon Charles 5,352 -
0
votes1
answer289
viewsA: how to take the word of the link clicked and send to the page that the link sends
You can pass the desired word as parameter in the link and pick the pagdownload.php echo "<a…
-
1
votes2
answers167
viewsA: Submit page after 3 attempts
Although you don’t understand the reason, you can keep the event .submit() using the .preventDefault() to prevent the submission of the form and then using the .unbind("submit").submit() to ignore…
-
1
votes2
answers2304
viewsA: onclick() in elements generated through ajax?
For elements like this generated from the javascript you will need to use the .on() $(".option").on("click", function(){ alert(); var text = $(this).attr("href"); window.location.href=href; });…
-
2
votes3
answers717
viewsA: How do I get the name of an input
You can also use queryselector console.log(document.querySelector("input").name) <input type="text" name="peixe"> Definition and Use The method querySelector() returns the first element that…
javascriptanswered Erlon Charles 5,352 -
0
votes1
answer224
viewsA: The Submit event doesn’t work when I try to register
How are you using event.preventDefault(); in his $("#loginForm") you will need to use a .unbind() to make the Submit on the location you want $("#loginForm").unbind('submit').submit();…
-
1
votes1
answer642
viewsA: IF condition codeigniter - Check whether data exists in the database(model)
You can simply check the variable $item before returning the function value //retornando com um if if ($item) { return $item; } else { return []; } //retornando com um ternário return empty($item) ?…
-
1
votes3
answers105
viewsA: Help to understand localStorage.js
It is not recommended to autocomplete users' password from the system, this should always be a user’s choice. Browsers even warn about this problem as a serious security breach. If you want to keep…
-
0
votes1
answer230
viewsA: Laravel store method with problem
The error he is reporting on line 30 is syntax. Try using the format below: $veiculo = new Veiculo(); $veiculo->marca = $request->input("marca"); $veiculo->modelo =…
laravel-5answered Erlon Charles 5,352 -
-1
votes2
answers212
viewsA: How to copy a piece of text within a textarea
Don’t do parse of HTML using preg_match. Use the Domdocument class Example: <?php $html= "<p>Olá!</p> <h1>Titulo H1</h1> <h2>Titulo H2</h2> <h3>Titulo…
-
0
votes1
answer143
viewsA: How do I add decimals to a counter?
A simple way to solve your problem would be to put something like days = days < 10 ? "0" + days : days; hours = hours< 10 ? "0" + hours : hours; minutes = minutes < 10 ? "0" + minutes :…
-
2
votes3
answers1235
viewsA: Calculate Interval of Hours
You can use the date_diff() <?php $datetime1 = date_create('2016-11-18 15:20:00'); $datetime2 = date_create('2016-11-18 15:45:02'); $interval = date_diff($datetime1, $datetime2); echo…
phpanswered Erlon Charles 5,352 -
4
votes1
answer253
viewsA: Customize cursor with css
you need to define which cursor will receive the image #esquerda{ width: 200px; height: 200px; border: 2px solid red; cursor: url(http://i225.photobucket.com/albums/dd43/erickson_29/basic.gif),…
cssanswered Erlon Charles 5,352 -
5
votes2
answers47
viewsA: Enable fields in Jquery
Use the function .on() to define the desired events, in our case keyup (check if a key has been pressed, when the key goes up) and change (check if the field value has changed), then use the…
jqueryanswered Erlon Charles 5,352 -
3
votes3
answers464
viewsA: IDE - Divergence between Ides relative to tab [to Enter]
You can configure your editor to use the tab pattern, the default options used by the editor by accessing the menu Sublime Text > Preferences > Settings - Default. All these options can be…
-
6
votes5
answers142
viewsA: what is the best way to create elements?
Using jQuery it is possible to create an element in a way that I particularly consider more elegant, but each element needs to be created individually. div = $("<div>", { "class" :…
-
1
votes1
answer266
viewsA: Return records from a table whose key is referenced in another Cakephp 3
On your return you possess feature_id in his product_features, therefore for each result of product_features make a get() $this->loadModel('Features') foreach ($product['product_features'] as…
-
1
votes1
answer112
viewsA: How to simulate a cast of a class in PHP (other than stdClass)?
According to the PHP Handbook, there are only types of Casts below, these cannot be natively customized: (bool) or (boolean) = Converting to boolean (int) or (integer) = Converting to integer…
-
3
votes1
answer184
viewsA: Send li value to input type Hidden
You are creating the input in the click, you should be checking the click how many elements were selected and created a input for each of those elements. To create a <input type="hidden">for…
-
2
votes3
answers145
viewsA: Is that a bug in stdClass?
stdClass does not accept parameters. The best way to define a value like this for sdtClass is a conversion: $std = (object)$c = []; var_dump($std); // Retorna object(stdClass)#1 (0) {} var_dump($c);…
phpanswered Erlon Charles 5,352 -
6
votes5
answers10525
viewsQ: Show every day between two dates
I need to display all dates that exist between two set dates. I do not need the information of the difference between these dates, nor the data that are in the interval between them, but show the…
-
4
votes3
answers139
viewsA: Exchanging link as input text
Yes, it is possible. You will use the event change to do this. $(document).ready(function(){ $("#qty").change(function(){ val = $(this).val(); newURL =…
-
1
votes1
answer668
viewsA: DIV with color division
You will need to use CSS linear-gradient. The linear-gradient linear-gradient is a CSS3 feature to create gradients between 2 or more colors in line. So you will need to use the following code to…
-
2
votes1
answer442
viewsA: Search first and last word of a record
If you want to get users who have the same first and last name, separate the string sought and seek every part of the name. Example: $nome = "Carlos Andrade"; $nome = explode(" ",$nome);…
-
1
votes3
answers472
viewsA: Ignore certain values in Mysql
User the NOT to eliminate unwanted values $query = "SELECT COUNT(status) FROM $nomeTabela WHERE status=$numeroStatus AND nomePessoa='$nomePessoa' AND status NOT IN(0)";…
-
1
votes2
answers61
viewsA: Transform into json
You can use javascript to do this using JSON.parse() JSON.parse('{name:"Sara", daypart:"day", href:"/questions/ask", bg:"su", temp:"calor", realfeel:"hot", text:"cloudy"}'); This will convert your…
-
6
votes2
answers3481
viewsA: Image inside of round div
Defining the overflow of div as Hidden it is possible to do this without using the image as background. If the image does not fit proportionally in the div set a background color for the image does…
-
1
votes1
answer245
viewsA: Problem in smoothing scroll on anchor links
Try this script on. Its use is simpler and you can see its working here. $(function() { $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//,'') ==…
-
1
votes2
answers715
viewsA: Codeigniter + Autocomplete Jquery UI does not return list
You’ll have to use AJAX to do this, as you are using $_GET to search you will need to use $.get() jQuery("#query").autocomplete({ source: function (request, response) { jQuery.get("<?php echo…