Posts by novic • 35,673 points
1,265 posts
-
5
votes3
answers7570
viewsA: Read PHP Multidimensional Array
You have to use a foreach which can even redeem the Internet, example: foreach ($array as $r => $k) { } where the $r is the index and the $k is the value respective, only that in your example you…
-
0
votes1
answer881
viewsA: How to assign the value of a Tempdata["Test"] or Viewbag.Id to an html input?
In his controller and method use ViewData, example: public IActionResult Index() { ViewData["IdFuncionario"] = 1; return View(); } and in the View respective: <input type="text"…
-
1
votes1
answer188
views -
2
votes1
answer768
viewsA: Add values from a table field
First you must select the repeating items, and then add up the freight value, example: SELECT SUM(ValorTFrete) FROM ( SELECT DISTINCT NumPedido, ValorTFrete FROM loja_carrinho WHERE StatusCompras =…
-
3
votes1
answer56
viewsA: How to check in a TXT if something repeats?
A simple and minimal example: Text File ID|NOME|TELEFONE0|ENDERECO|REFERENCIA ID|NOME|TELEFONE1|ENDERECO|REFERENCIA ID|NOME|TELEFONE2|ENDERECO|REFERENCIA ID|NOME|TELEFONE0|ENDERECO|REFERENCIA PHP…
-
0
votes1
answer272
viewsA: Angularjs reading JSON positions
I would do with this logic, bringing the data and putting in a variable without modifying your data or formatting, after that just use ng-Options and two variables to load the return information, ie…
-
3
votes2
answers622
views -
4
votes2
answers176
viewsA: Select a certain amount of data for each status type
Use the command SQL UNION ALL example: (SELECT codigo, data, status FROM historico WHERE status = 'AVALIAR' ORDER BY DATA DESC LIMIT 20) UNION ALL (SELECT codigo, data, status FROM historico WHERE…
-
1
votes1
answer362
viewsA: How to configure Automapper in a Windowsform project?
To configure the Automapper in an application Windows Forms, follow the following steps: Install the package via NUGET PM> Install-Package AutoMapper Create the templates that should be used in…
-
2
votes1
answer362
viewsQ: How to configure Automapper in a Windowsform project?
How do I set up Automapper in a Windows Forms app, being: Which file and should I configure to load together with the application and make it available? How to use with a simple example?…
-
2
votes2
answers2510
viewsA: Pass string to uppercase - Standard
In his model Servidor make a Mutators that the value will always be uppercase from that configuration, from that code below, as an example: <?php namespace App\Models; use…
-
2
votes1
answer179
viewsA: Get data as Array and not as object - Codeigniter
Need to add along with array_filter the array_values, so that the array, example: for ($i = 0; $i < count($negociacoes); $i++) { $id = $negociacoes[$i]['id']; $negociacoes[$i]['parcelas'] =…
-
0
votes1
answer72
viewsA: Laravel Schedule Frequency Options Do Not Work
The command described in the documentation is: * * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1 in your case: * * * * * php /var/www/html/Test/artisan…
-
2
votes1
answer1038
viewsA: Correct alternative that implements a validator for a date field in Laravel
I believe that this is the best, its date that comes from the screen is in Brazilian format, IE, day, month and year, utilize date_format in d/m/Y format: $this->validate($request, […
-
1
votes2
answers874
viewsA: Select specific columns from two related tables
It’s like this, when the Eloquent makes the relationship and carries the relationship, the keys that relate should be contained in the results of the SQL, because, these values are used to load…
-
1
votes2
answers170
viewsA: Doubt - Savechanges does not work, only returns 0
The Entity Framework do not change anonymous objects, and yes only changes the one he knows and is contained in his context. In this code for example, it happens that the creation of a type that the…
-
1
votes1
answer260
viewsA: Routine to download and unzip zip file on the server itself
Using Httpclient and the System.IO.Compression.Zipfile installation via nuget, with a minimal example: HttpClient web = new HttpClient(); string url = "http://www.caixa.gov.br/Downloads/"; url +=…
-
1
votes1
answer97
viewsA: Using Whereraw with Datediff
It would not be so, ie the field updated_at no quotes, because it is a field of your table: whereRaw("(90 - (DATEDIFF(now(), updated_at))) = 7")
laravel-eloquentanswered novic 35,673 -
1
votes1
answer1089
viewsA: Validation Can you compare 2 fields not to repeat in the database?
Your question is a little confusing, but I believe it is a validation of this type, where the two fields have to be unique in the table, below a minimum example of how to do this: <?php namespace…
-
2
votes1
answer346
viewsA: Create a preview of an XML file with Codeigniter
Basically your code can be reused because, already generates the information, but, I will propose a simple example through a xml with ajax: Organization of Folders XML <?xml version="1.0"?>…
-
1
votes1
answer666
viewsA: Convert TXT to XML using C#
To transform from text to xml use the class Xmltextwriter and whether the layout be that with a header and the rest the values of each item of the header have to use a little logic, a little bit of…
-
3
votes1
answer2176
viewsA: Change date format in Java?
Perhaps the fastest and perhaps not very safe way (if the format is always in this pattern, can be used smoothly), but, functional would be: var _str = '2016-03-01'; _new =…
-
0
votes1
answer335
viewsA: Saving multiple images
The solution is that instead of just doing with an image your code has to iterate on the result of several images, in this case it is a array now, example: if ($request->hasFile('imagem')) {…
-
2
votes4
answers7452
viewsA: Formatting date with Laravel
Don’t change anything in yours model in the standard question, only make a new field that will be shown from the results of the same, if you want a date in the specific pattern, create a method that…
-
3
votes2
answers501
viewsA: I cannot use the foreach with object twice in the same view in the Laravel
The error: @foreach($cidades as $cidades) <option value="{{$cidades->id}}"> {{ $cidades->nome }} - {{ $cidades->estado->sigla }} </option> @endforeach Explanation: in foreach…
-
0
votes1
answer168
views -
0
votes3
answers1086
viewsA: Storing an attribute’s value in a variable in jquery
I thought it was weird you put it on #nav of html, wouldn’t just be id="nav"? It has also been reported that it is not a good practice id with same name, so check this html because it actually has…
-
1
votes1
answer417
viewsA: How to set up sending email in Laravel within cron?
To create an email with data coming from the database or any source you feed, do the following: Type in the command line: php artisan make:mail ExampleCronSend this will create an email…
-
3
votes1
answer1490
views -
22
votes1
answer13616
viewsA: How to create a cron in Laravel?
To create CRON in the Larable follow the following steps: First create a command as follows: php artisan make:command ExampleCron --command=example:cron inside that file that was created in the…
-
1
votes1
answer544
viewsA: How to perform a double consultation in the Standard?
Use the \DB::select that the simple way to carry out consultations in this way: Example: $sql = ' select * from payments as P, receipts as R '; $sql .= ' where P.created_at < CURRENT_DATE AND…
-
1
votes1
answer39
viewsA: Working with Routes in Laravel
Error message explains meaning of error, saying that constant does not exist, what is expected in your code is in quotes, example: public function create() { return view('imoveis.create'); }…
-
0
votes1
answer150
viewsA: Session with Ilist on Asp.net mvc5
There’s a way I can create a Session with values of an array of the type IList in Asp.Net Mvc5? Yes, just add the value in the session as follows: Configure the application to know that you need to…
-
1
votes1
answer1478
viewsA: Clasura Where em campo tipo json no (Laravel + Eloquent)
For an explanation of the site the logic would be with JSON_CONTAINS mysql> SET @j = '{"a": 1, "b": 2, "c": {"d": 4}}'; mysql> SET @j2 = '1'; mysql> SELECT JSON_CONTAINS(@j, @j2, '$.a');…
-
1
votes1
answer150
viewsA: Insert data into Oracle table "no returning id into"?
Good by the looks of your bank the field CD_SEQUENCIA is the field that has its value generated by the data bank, so try to configure the Model, informing their $primaryKey: class ModelCriado…
-
6
votes1
answer364
viewsA: How to get value from a json?
Install the package Newtonsoft.Json, then create these three classes: public class Rootobject { public string type { get; set; } public Art art { get; set; } public Mu[] mus { get; set; } public…
-
2
votes1
answer2487
viewsA: How to reset an input type="file"?
To clear the contents of a input type file use with javascript: document.getElementById("id_do_elemento").value = '' or with jquery: $("id_do_elemento").val(''); From your minimum example, was added…
-
1
votes1
answer531
viewsA: Insert Many to Many Laravel 5.5
If your doubt is insert into the Many to Many Laravel following the documentation stays: $insert = Product::create($data_form); if ($insert) // foi inserido. { $providers =…
-
3
votes2
answers1084
viewsA: Pass SQL value to a VB.Net variable?
To bring this information use the class Mysqldatareader setting its variable with the return of the Mysqlcommand .ExecuteReader() , example: strsql = "select Nome, Senha from users where…
-
0
votes3
answers684
viewsA: Update registration with Laravel 5.2?
You could check whether the item has actually been set and whether the same exists with the public property $exists: public function alterar($id) { $produto = Produto::find($id); if ($produto…
-
1
votes1
answer608
viewsA: Laravel 5.5 - Validation Method does not exist?
In class $request of Larable 5.5 which has the method it needs which is validate, then, Change your code: //Validação de Dados $this->validate($request, $this->categoria->rules); // Errado…
-
3
votes2
answers1578
viewsA: How to Perform IF function when selecting Combobox item?
if (comboBox1.Items.Count > 0) comboBox1.SelectedIndex = 0; // posiciona no primeiro item if (string.IsNullOrEmpty(comboBox1.Text) == false) { var adapter = new…
-
1
votes1
answer1585
viewsA: Alphabetically Sort an Arraylist
Use the Collections.Sort with the Interface Comparator to order the same array, minimal example: Teste a = new Teste(); a.setDepto("3"); Teste b = new Teste(); b.setDepto("2"); Teste c = new…
-
2
votes2
answers916
viewsA: Orderby with ng-repeat nested in the Angularjs
When you need to sort a list of values and they are in different keys, you need to format the layout for a new one, then the initial proposal is to create a new one array with the key associados,…
-
0
votes2
answers954
viewsA: PDO Insert Record
If you have any problems, report the problem by putting this in your question, an error screen helps a lot to solve problems like this That: INSERT INTO title, startdate, enddate VALUES (:title,…
-
1
votes1
answer706
viewsA: Laravel / Eloquent - Consultation in more than one table
Relationship N:M Laravel The models are set wrong in item fillable failed to put the fields correctly and their relations are all wrong, see documentation for more information and the links below…
-
4
votes1
answer709
viewsA: Stacking and popping with javascript queue
It seems that your text also has problems, stack is PILE, and line up is QUEUE, has a different meaning in the computer world, where PILE the first that enters is the last that leaves, because the…
-
1
votes1
answer210
viewsA: Eviar view parameter for action
Must pass the third equal role is in your documentation: @Html.ActionLink("Aprovar cadastro", "Aprovar", new {Id = item.id}) this is called method overload (overload) Overload List:…
-
2
votes1
answer678
viewsA: Sum of quantity multiplied by product value in daily sales
The right way would be: $select = "sum(produtos_venda.valor*produtos_venda.quantidade) as total,"; $select .= "vendas.cliente_id, clientes.nome, vendas.data"; $vendas = Venda::where('data',…
-
2
votes2
answers2878
viewsA: Open a modal with a button in another modal?
From what I understand, a modal opens, and soon after its closure, opens another modal, if this is it, I decided to make an example: jQuery(document).ready(function() { $("#open").click(function() {…