Posts by JrD • 1,319 points
53 posts
-
1
votes3
answers1368
viewsA: Get Laravel login user address
When creating this function public function endereco () { return $this -> hasOne(Endereco::class,'user_id','id'); } your model User is replaced by a reference to the model Endereco. To access…
-
0
votes2
answers643
viewsA: Change value <td> dynamically with Javascript
This can be done by adding the values into one data attribute and alternate them using the .on("change") When changing the radio, the change event will be triggered. This event checks the value of…
-
0
votes1
answer55
viewsA: Print the counter result
Add an id to <td> that you want to enter the values, in this example I added the ids "total_approved" and "total_disapproved". It was necessary to remove the global counters, because with each…
-
0
votes1
answer323
views -
2
votes2
answers635
viewsA: Breaking lines in text from the database
To Display data without exhaust in Blade you can do with {!! $text !!} and can complement the nl2br to arrive at the expected result. It would look like this: <div> <p class="cont">{!!…
-
5
votes1
answer591
viewsA: How to delete an item from an object using an internal ID (Vue-2)
One way to do this would be to go through the entire list until you find the searched id, then remove that element, follow an example <div id="app"> <div v-for="(item, index) in lista"…
-
1
votes1
answer59
viewsA: click and Hover does not work
First, an id must be a single selector, you are adding several elements with the same Id on the screen... Change the id selector to class or select selector of your choice. Second, when adding the…
-
2
votes1
answer49
viewsA: How to enter stipulated amount of the same record in the database with different id in LARAVEL
You can put the create in a loop for to solve this problem public function criarRegistro(Request $request) { $this->validate($request,[ 'category_id' => 'required', 'card_details' =>…
-
1
votes1
answer16
viewsA: change image with a BUG button
Change your currentImgIndex for a boolean. When lighting the image, currentImgIndex changes the value to true, Deleting changes the value to false. In function trocar3() just reverse the value by…
javascriptanswered JrD 1,319 -
1
votes2
answers97
viewsA: Accessing an element within the same element hierarchy
You can use the .Parent to find the parent of the element text (in this case would return the first g of the tree, which contains the class="children" and from it search for the rect referring to…
-
1
votes1
answer66
viewsQ: What is the difference between Eloquent Model::get() and Eloquent Model::all()?
What’s the difference in using Model::get() and Model::all()? Some of them are more recommended to bring all the bank records?
laravel-eloquentasked JrD 1,319 -
1
votes1
answer119
viewsA: Can anyone tell me why the "#obj" doesn’t move?
Its function getY is returning NAN when running the first time, top does not have a defined value. You can use a ternary conditional operator to return a value if top does not have a value, in this…
-
0
votes1
answer94
viewsA: Save data attribute data to an Hidden input
You can use the function date to take the aliquot values. In the example I stored all aliquots in an array and inserted that array into the input hidden window.onload = function(){ var aliquotas =…
-
1
votes1
answer722
viewsA: Value appears and disappears after click-Javascript
By default, the <button> assumes the type as submit, when within a form. What is happening is that by clicking the Submit event button is triggered and then the form is "sent" making the page…
-
2
votes1
answer137
viewsA: Maximum Execution time doesn’t work?
The ini_set, according to its own documentation Sets a new value for the specified configuration option. The configuration option will keep the new value during script execution and will be restored…
-
2
votes1
answer484
viewsA: How to insert error message in Input?
Add a content element to the error message (in the example, I used a span). Add a counter before the filter, to store the number of successful occurrences in the search, if there is no occurrence…
-
5
votes3
answers222
viewsA: Show div after a certain amount of input digits
One way is to run the event on keyup and check the size of the input value. To hide the div just put the event on document and check by clicking if the event contains the div #pesquisas, if it does…
-
0
votes1
answer39
viewsA: Running a function after selecting an item in the duallistbox double check box
The event is applied to the same class used to create duallistbox. then change the code $('select.dual').on('change', function() { //console.log($(this).length); }); for…
-
0
votes1
answer67
viewsA: Can anyone tell me why if Else is not returning Is it?
You make a search in the database looking for the CPF informed, so if vc type a CPF that does not exist in the base your select will not return any record, making it not enter nor the foreach. You…
-
2
votes5
answers304
viewsA: because my class only returns NULL
You are calling the function getContato class msgContato and the function just arrow the names, has no return or any other action, so the expected is not returned even (or null). Make the function…
-
2
votes2
answers35
viewsA: Help with php number_format
Use the number_format after splitting, thus: $subjects[$i]['mark_final'] = number_format(($final/4), 1);…
-
2
votes1
answer73
viewsA: Validate Captcha in PHP by Jquery
You can use the data attribute to easily take this value and make the comparison. To do this just add the data attribute in your div that contains captcha and then you can perform the comparison…
-
1
votes1
answer24
viewsA: Why this Reference Error
You defined the method as static and a static method is only accessed directly in class, see: class Estatica{ static metodo(a) { return a + 1; } } //funciona, pois estou invocando o método…
-
0
votes1
answer30
viewsA: Select with multiple JS values
The id of an element is a unique identifier (better explanations) and you have placed several elements with the same id, so your script will look for the first element with that id informed and…
javascriptanswered JrD 1,319 -
1
votes1
answer134
viewsA: Button click event is only held once in jQuery
As I said in the comment, you were not changing the name attribute of your button, so you had the impression that the event was only triggered once. You must change this name every click of the…
-
0
votes1
answer69
viewsA: Merge two array’s recursively without adding new keys
I imagine that function meets your needs //&$default é o array a ser modificado, recebido como um parâmetro por referência e $data é o segundo array que irá sobrescrever o primeiro function…
-
0
votes1
answer2031
viewsA: matrix generate random number from 0 to 99 without repetition Visualg
Well, with each number generated you can go through your entire matrix, to check if the number has not already been inserted, if it has not entered you enter it, but if it has already been inserted…
-
0
votes1
answer51
viewsA: Doubt in Javascript when creating dynamic Ivs
Your masks are only loaded on $(document).ready() and its elements are inserted after this, you must find a way to reapply these masks after inserting a new element on the screen, I believe…
-
3
votes2
answers1083
viewsA: Calling JS function by Select
To call a function when changing the select you can use the onchange that will trigger the call whenever you select another option function mudarSelect(valor){ console.log(valor); } <select…
-
1
votes2
answers295
viewsA: Return value per json and return to a function
Your function has errors that are preventing it from running. First you have put a return before the call ajax, That will stop the function in that return and nothing below it will be executed.…
-
2
votes2
answers315
viewsA: delete from a row of the selected table
The idea is to go through all the tr which has the "color" class, capture its id and use the remove to remove from the table, from there vc makes the call for removal in PHP function deletar(){ var…
-
0
votes1
answer220
viewsA: Bring a pre-selected day with Datepicker BOOTSTRAP
For datepicker you have the option startDate, to initialize datepicker with a preset date just add it $('#agenda_profissional_online').datepicker({ format: "yyyy-mm-dd", //este é dia 5(datas[0]) que…
-
1
votes2
answers1068
viewsA: Problems with event click on jQuery, AJAX, and PHP
Well, first recommend that you remove id status (once the id of an element needs to be unique) and change it to class, so avoid id conflict, your lines where buttons are added would be more or menso…
-
1
votes1
answer42
viewsQ: How to auto-complete a value without overloading the database
Well, I’m working with a table with a little over 60,000 records and a situation has arisen in which, through an input the user can search some text that contains in a record. Initially the user…
-
0
votes1
answer2782
viewsA: How to add php hours
Well, I found it simpler to calculate the total hours separately from the interval and then perform a simple subtraction of the two, follows example: $entrada = new DateTime('2019/03/22 22:30:00');…
-
1
votes2
answers344
viewsA: Determine the amount of times a number can repeat in an array
Using the idea presented in C# by @Cypherpotato I made the PHP implementation. The idea is to put in a loop to generate the array of the 9 positions and go checking the amount of values already…
-
1
votes1
answer400
viewsA: Activity Issue: How to Type PHP Zip Code Checker
I don’t know if this kind of CEP validation is accurate, but given your need to find this validated, you can do something like. $cepCliente = "41600-610"; $cepClienteSemTraco = str_replace("-", "",…
-
2
votes2
answers118
viewsA: insert into an imput table data
The problem with your code is using the same id for all rows in the table, when working with id, use unique id’s to manipulate the elements. In your case I do not see the need to manipulate these…
-
1
votes1
answer23
viewsA: Error searching for Description in another related table
Your mistake is in return $this->belongsTo('App\Models\TituloTipo'); When using the belongsTo with only one parameter you assume that the Foreign key will be the name of the related model…
-
2
votes2
answers96
viewsQ: Passing object as parameter changes the original object
I’m passing an object as a parameter to another function. In my years of study in college it has always been differentiated the passage by reference and value, in the case of the object it always…
-
1
votes1
answer26
viewsA: Different methods call a validation method, I want to know which method called validation
In php has the function debug_backtrace() that 'generates a backtrace', but generates in the current method $backtrace = debug_backtrace(); But we can turn the backtrace to a level to see where the…
-
1
votes2
answers102
viewsA: Add new checkboxes with ajax
The bind is only being applied to elements that are already loaded on the screen, that is, after adding the element dynamically it is not recognized. Change the following code line…
-
1
votes2
answers63
viewsA: Change only 1 element and not the selected one
You can change the opacity of all buttons and then reverse the clicked one... It would look like this: <script> $(".cadastro").click(function(){ $('.informe-cnpj').slideDown(400);…
-
1
votes2
answers397
viewsA: Sum values of a column td
You can add these values while filling the table and right after displaying this result var total = 0; for(var i = 0; i < dataset.values.length; i++) { row = dataset.values[i]; linha =…
-
1
votes1
answer785
viewsA: Add +1 min to countdown timer - With timer already finished or in progress
First you need to bind to the onPress button so that it is possible to access the state of the application, it would be like this: onPress={this.somarUmMinuto.bind(this)} Then you need to create the…
-
1
votes1
answer96
viewsA: Laravel - default route
A simple way to solve this: Route::any('{any}', function () { return redirect('/'); }); any refers to 'anyone'. Then regardless of the HTTP verb used or the route typed it would return to home…
-
4
votes1
answer3735
viewsA: How to update an on-screen variable in React-Native?
To change the status on React is used the setState that will evolve the current state to a new state, then in place of this.state.teste = 'blabla' one should use this.setState({teste: 'blabla'}). Up…
-
1
votes1
answer119
viewsA: PHP code to query MYSQL by leaking memory
Well, I don’t know how much memory is needed to allocate this query, but to fix this problem you can either increase the memory limit to be used by php.ini or simply use php.ini ini_set to set your…
-
2
votes2
answers399
viewsA: How to make a @foreach with Relationship Tables in Laravel
In your controller I believe that your query is being made in the wrong way. The $this refers to the current class, in your case, the controller. Then the $this->reclamante would result in…
-
2
votes2
answers1526
viewsA: Create array within JSON object
Use the push array to add a new item within this attribute, follow an example: var novo_item = { "id" : delDiv2, "nome" : nomeItem2.value, "cod" : codItem2.value }; objeto.item.push(novo_item); or…