Posts by Jorge Costa • 1,430 points
70 posts
-
0
votes1
answer81
viewsA: My ajax request does not work when I put it on the web route, only in the api
Pass the _token inside the date parameter function criarnovoCliente() { console.log('entrou na função'); client = { _token: $('#token').val(), nomeCliente: $('#nomeCliente').val(), emailCliente:…
-
1
votes2
answers107
viewsA: Registering data with Laravel
Using the save() method on the model. public function newAccount( NewAccountRequest $account) { $user = new UserSystem; $user->first_name = $account->get('first_name'); $user->last_name =…
-
2
votes2
answers109
viewsA: How to insert a serialize into the database in a string field
Make use of what Laravel offers, in case attribute casting. https://laravel.com/docs/5.8/eloquent-mutators#attribute-casting Laravel serializes, unserializes automatically. In his Model protected…
-
0
votes3
answers157
viewsA: How to do explode inside the $request->all() array
A solution using Laravel’s Ollection $array = array( "_token" => "NZ68b8h3L560aUc6DXBeb8Myb4JFD0hSgfSpJ2Lk", "_method" => "PUT", "col1-22" => "22", "col1-26" => "26", "col2-23" =>…
-
0
votes1
answer86
viewsA: Disable required data Annotation via jquery
$(document).ready(function() { $('#firstname').prop('required', false); $('#firstname').removeAttr('data-required'); }) <script…
jqueryanswered Jorge Costa 1,430 -
0
votes2
answers242
viewsA: How to instantiate one model inside the other in the view?
The hasMany relationship, represents a relationship of one for many. See https://laravel.com/docs/5.8/eloquent-relationships#one-to-Many In your case a debt many securities. Note: The method in the…
-
1
votes2
answers110
viewsA: How to update a table with an array in the Laravel?
I advise to study a little the documentation of the Eloquent of the Laravel. https://laravel.com/docs/5.8/eloquent To create a record use the create method(); $form_data = array( 'numdoc' =>…
-
1
votes2
answers88
viewsA: How to recover calculated fields in Laravel?
The best way is to use an accessor https://laravel.com/docs/5.8/eloquent-mutators#Defining-an-accessor class Divida extends Model { /** * obter total da dívida. * * @return float */ public function…
-
0
votes1
answer325
viewsA: Mobile Validator in a Rest Api query
The Substring(int startIndex) method returns the rest of the string from the given position (startIndex). See…
-
1
votes2
answers34
viewsA: Select does not return values correctly per month
You can use CASE When Then ELSE END SELECT classificacao, descricao, saldo_anterior, CASE WHEN MONTH(periodo)=1 THEN saldo_atual ELSE 0 END AS Janeiro, CASE WHEN MONTH(periodo)=2 THEN saldo_atual…
mysqlanswered Jorge Costa 1,430 -
1
votes2
answers199
viewsA: Relation Hasmanythrough returns empty Eloquent
Assuming you sell products is a pivot You can use a Manytomany type relationship namely a "sell many products a many sales product" Documentation in…
-
1
votes1
answer127
viewsA: Select no Laravel is returning the column name (Eloquent)
Controller public function resultadoconsulta(Request $request){ $nome = $request-> nomeCompleto; $data = $request-> dataNascimento; $paciente = Pacientes::select('nome_completo')…
-
1
votes3
answers4742
viewsA: Convert string to dd/mm/yyyy hh:mm format
Convert the date to UTC Format See more about in: https://stackoverflow.com/questions/40768606/i-have-a-utc-string-and-i-want-to-convert-it-to-utc-date-object-in-javascript/40768745#40768745 var…
-
0
votes1
answer33
viewsA: search is not returning the php, mysql data
The query is not well built In the query using the where clause compares with a text type field so you have to involve the comparison value between ', e.g. 'value' example: $tipo_prod="tipo1"…
-
1
votes3
answers1872
viewsA: Create a Request validation in Laravel with the Unique rule
You can configure the rules according to the method used. Within Formrequest you have access to request(), route(), method(), etc.... public function rules() { $regras = [ 'name' =>…
-
1
votes2
answers213
viewsA: How to make Ckeditor mandatory to fill in as a required attribute
See the functional example in https://jsfiddle.net/jorgercosta/306gfwy5/10/ Using the event 'required'…
-
1
votes1
answer92
viewsA: Ternary Laravel Relationship
You can use the whereHas method https://laravel.com/docs/5.8/eloquent-relationships#querying-Relationship-Existence $user_id = Auth::user()->id; $surveys = App\Survey::whereHas('options',…
-
1
votes2
answers73
viewsA: jquery selector for a single cell of a "table" made with bootstrap
Supplemented by the previous answer for two reasons Ensure all column widths That the grid is from class analists That the code is exactly the same as $('.analists .s1,.analists .s2, .analists .s3,…
-
0
votes2
answers22
viewsA: Doubt about ajax (javascript)
I advise to research about query strings is that actually its limitation and that has nothing to do with the request via Ajax. See an article on query string in Wikipedia…
-
2
votes1
answer188
viewsA: Poor field formatting when exporting the Crystar report to PDF
Crystal in some cases reduces font size by exporting to PDF in order to avoid omissions in the text. Can be solved by adding a key to the Registry. I have already succeeded with the solution…
crystal-reportsanswered Jorge Costa 1,430 -
3
votes2
answers70
viewsA: I’m learning, so it’s a basic question
When running the program it performs Writeline but exits immediately You can wait for a keystroke to be pressed before leaving string endereço, cpf, telefone, nome; Console.WriteLine("Digite o nome.…
-
2
votes2
answers133
viewsA: How to set a variable in the configuration of a Virtual Host, to avoid repetition?
You can use the Define directive See document on https://httpd.apache.org/docs/2.4/mod/core.html#define Define pasta /var/www/meusite/ <VirtualHost :80> ServerName meusite.local ServerAlias…
-
0
votes1
answer301
viewsA: Is it possible to connect to a VPN via C#code?
You can try calling using an external process System.Diagnostics.Process.Start("rasdial.exe", "a_minha_ligacao utilizador palavra-passe");
-
1
votes2
answers72
viewsA: Contrast application on the page via cookies
Change the second if to only be executed when the first condition is not reached. In its code the second if was always evaluated in this version is evaluated only if the first condition is reached.…
-
2
votes3
answers810
viewsA: php Session - destroy all Sessions and keep only one active
You are misreading $_SESSION represents the current session, is an associative array with session data, $_SESSION['session1'] represents variable saved in that session. to delete a session variable…
-
2
votes1
answer132
viewsA: Qrcode appears generated as incorrect image
There are several errors with your code that you are not detecting because you are using getCode.php as image src, if you invoke getCode.php directly in the browser for sure it will identify them.…
-
0
votes2
answers60
viewsA: How can I check if within one string there are others?
To do this check you can use the method index of String This method is case sensitive (so we change the string and search key to uppercase), returns -1 when it does not find the key to search…
-
4
votes2
answers225
viewsA: How to use preg_match() to catch a link within a Javascript code
You can check in: https://www.phpliveregex.com/p/oLJ \$\("#download-botao"\)\.attr\("href", "(.*)"\); array(2 0 => $("#download-botao").attr("href", "link.com"); 1 => link.com )…
-
2
votes1
answer222
viewsA: Validation does not return array with errors
When using routes defined in api.php, as referred by Luhan Salimena is not applied the middleware group Shareerrorsfromsession (see configuration in Kernel.php). Without application of this…
laravelanswered Jorge Costa 1,430 -
1
votes1
answer350
viewsA: Does not work the "Soapwrapper" with Laravel
Check the comments //instancie um novo objecto $soap = new SoapWrapper; //estava a faltar o primeiro parâmetro 'rmFametro' $soap->add('rmFametro', function ($service) {…
-
1
votes1
answer53
viewsA: Access to property value
tables must be an array, cannot use idMesa repeatedly keys must be unique in each object Wrong shape mesas={ idMesa:{}, //está repetir a chave idMesa:{} } Correct form mesas=[ {idMesa: 1}, {idMesa:…
-
0
votes1
answer300
viewsA: How do I send a single email to all administrators in Aravel 5.4?
Laravel 5.4 According to the documentation https://laravel.com/docs/5.4/mail#sending-mail The method to() , accepts an email address, an instance of user, or a collection of user can also pass a…
-
-1
votes1
answer254
viewsA: Pass innerHTML inputs to form and access via PHP
Watch out: quotation marks around the html required attribute does not need to assign value Updating: Using jQuery to show that the added input is part of the form. var div =…
-
0
votes1
answer24
viewsA: Undefined object reading from Indexeddb (JS)
Change: var dData = rReq.result; // <-- A variável "dData" fica "undefined" for var dData = e.target.result;
-
0
votes1
answer1211
viewsA: Page break with fpdf php
You’ll have to extend the FPDF class The method Acceptpagebreak() will be called whenever a page break is needed, if you are in the last column you will have to jump to next page otherwise jump to…
-
1
votes3
answers44
viewsA: Send form without knowing the name
You can get the form name by the relationship between the button and the form itself function altera(meuForm){ alert(meuForm.name); meuForm.submit(); } <form method='get' action='GG.php'…
-
1
votes2
answers234
viewsA: How to redesign a Datatable if a checkbox is checked?
Example You need to pass a parameter to the server indicating that you want all users, in case the "" parameter in the user $('#all_users').click(function () { if ($(this).is(':checked')) { var…
answered Jorge Costa 1,430 -
0
votes2
answers100
viewsA: Save the data from the array and not your key
You need the array keys to be equal to the values $result = array_combine($cda->toArray(), $cda->toArray()); //debug Array ( [valor 1] => valor 1 [valor 2] => valor 2 [valor 3] =>…
-
0
votes1
answer650
viewsA: Accessor/Mutator do Laravel
The implementation of Mutator (set) is correct The implementation of Accessor (get) return a value Replacing public function getCustoAttribute($value) { $this->attributes['custo'] =…
-
2
votes3
answers789
viewsA: Doubt Passing Laravel Array Routes
The function (helper) allows you to pass an array as a second parameter such as in the route parameters, see helper route see: https://laravel.com/docs/5.6/helpers#method-route In yours is passing a…
-
0
votes1
answer16
viewsA: save cookies to the array and then print
According to PHP documentation http://php.net/manual/en/control-structures.foreach.php foreach (array_expression as $value) statement foreach (array_expression as $key => $value) statement Error…
phpanswered Jorge Costa 1,430 -
1
votes1
answer393
viewsA: Select2 + Jquery - Autocomplete Problem
Problem Data is not being filtered when a search key is typed. According to the documentation on the plugin site: https://select2.org/data-sources/ajax Select2 expects Results from the remote…
-
1
votes2
answers216
viewsA: Use array type variable that returns the ajax function in PHP?
If you are doing POST at least you have to get the variable $cnpj =htmlspecialchars($_POST["cnpj"]);
-
0
votes2
answers198
viewsA: Filter in a Select MYSQL via PHP (Ionic 3)
You can pass the date as a parameter in your route On the client side, add method with a date parameter for date search, at http request url pass date: /product/'+ date getAllByDate(data) { return…
-
1
votes1
answer245
viewsA: Notice: Undefined offset: 5 in C: xampp htdocs My projects teste2.php on line 10, the value of the arrays being a form value
Problem Checkbox value not sent in POST if not selected. Solution Check that the value is set in the $_POST array before using it. $nro_funcoes = 10; for ($id = 1; $id <= $nro_funcoes; $id++) {…
phpanswered Jorge Costa 1,430 -
0
votes3
answers48
viewsA: Syntax error concatenation
Answer In php you can concatenate with "." in javascript you must use "+", your code is mixed. function setarRegistro() { campos = "teste=" + encodeURI(document.getElementById('teste').value) +…
javascriptanswered Jorge Costa 1,430 -
1
votes2
answers86
viewsA: How do I copy and paste to a screen?
Solution make the unbind to for specific input. Example: $( "#foo" ).bind( "click", handler ); $( "#foo" ).unbind( "click", handler ); Practical example $('input').bind('copy paste', function(e) {…
-
0
votes1
answer525
viewsA: How to change the datatable property of a created table
Datatables has a number of settings that can only be set at startup not later. See https://datatables.net/manual/tech-notes/3 for more details Proposed solution To change this option destroys the…
answered Jorge Costa 1,430 -
0
votes2
answers941
viewsA: Grab id from clicked button when clicking another button
Solution using javascript only window.idBotaoClicado =0; function botaoClicado(e){ window.idBotaoClicado= e } function ok(){ alert(window.idBotaoClicado) } <div class="row"> <div…
-
1
votes1
answer1689
viewsA: Check if cookie exists with Javascript
You can check this way if (document.cookie.indexOf("gravado") < 0) { alert("O cookie não existe vou criar"); document.cookie="gravado=sim"; } else { alert("Já está gravado, vou eliminar");…