Posts by novic • 35,673 points
1,265 posts
-
1
votes1
answer200
viewsA: How to enter values in Laravel
In the Laravel how to use it follows the example: DB::insert('insert into users (id, name) values (?, ?)', [1, 'Dayle']); in your case: $sql = "INSERT INTO tabela (campo1,campo2,campo3)…
-
4
votes2
answers954
views -
2
votes1
answer340
viewsA: How to change Laravel’s relationship keyword
The Larable is very flexible in this regard, as the database already existed and consequently did not follow the same nomenclature of Laravel, there are ways to pass the key names in the settings,…
-
1
votes1
answer47
viewsA: Use find field returned to add more results in the same query
If you can use the whereRaw to write a Sub Query as follows: $subQuery = 'relacionado = (SELECT relacionado FROM produto WHERE id=? limit 1)'; Produto::whereRaw($subQuery, array(7996))->get();…
-
1
votes2
answers274
viewsA: Return of Collection after Update
There is nothing prepared by Framework Laravel but, there is how to make a method to solve the update problem and then return the collection with Query Scope: Within your class User create a method:…
-
0
votes1
answer43
viewsA: How to catch daughter entities from a data constraint?
The Way to Circumvent a Feature Not So Far in the Version Entity Farmework 6.2.0 is using the packets: Z.EntityFramework.Plus.EF6 Z.EntityFramework.Plus.QueryIncludeFilter.EF6 With these two…
-
1
votes1
answer1531
viewsA: Validate password using Laravel
An example, with different data from yours is the following: $rules = array( 'username' => 'required|alpha_num|min:3|max:32', 'email' => 'required|email', 'password' =>…
-
2
votes2
answers995
viewsA: Lazy Loading EF Core, upload daughter entities and daughters?
You just put the relationships apart by one point (.), example: var entidade this.repository.Get<Entity>(x => x.Id == 1, "Filha1.SubFilha1") .FirstOrDefault(); you won’t even need to change…
-
1
votes2
answers1024
viewsA: Update Updatepanel after running ajax without page refresh
You are using the component Updatepanel who already plays the role of ajax who is trying to ask in your question, a basic example will be demonstrated with a minimal example: How it’s gonna work: By…
-
2
votes2
answers120
viewsA: Lambda expression to return a Person in the repository - DDD and Aspnet.Core
By means of that my answer, can bring a Pessoa with the reference if it is PessoaFisica or PessoaJuridica as follows: public Pessoa GetJoinById(int id) { var pessoa = Db.Pessoa.FirstOrDefault(x…
-
1
votes2
answers141
viewsA: How to make a multiple variable definition in VB.net
The way it is in your question, can not, because as you said yourself can not compare with other languages, but, there are means of assignments that will work as equal assignments for each instance…
-
0
votes3
answers2963
viewsA: Problem for popular Datatable?
You have problems returning your code, in the variable $data is not returning a array only the last item: <?php include("../includes/config.php"); if ($_POST) { $id = (int) $_POST['idcliente'];…
-
2
votes2
answers64
viewsA: PHP variable problem with pelicas
Basically use htmlentities: <?php $cota = '946.9"1968/1975" AMA Ant'; echo '<input type="text" value="'.htmlentities($cota, ENT_QUOTES).'" />'; Reference: htmlentities…
-
2
votes1
answer407
viewsA: Multi-table heritage in Laravel
The way it was created to work with this type of relationship is Polymorphic Relations, in the question only the name of the tables was informed which is enough to create a minimum example:…
-
1
votes1
answer463
viewsA: How to load Fileupload image to <Asp:Image> tag?
Basically to bring a preview of an image as chosen by input file, using jquery with Filereader is the next: $("#foto").on('change', function() { if (this.files[0].type.indexOf("image") > -1) {…
-
0
votes2
answers402
viewsA: Return data from a Linq query to an EF Core repository
With Entity Framework Core there is a possibility to load the relations and/or the collections subsequently, example: using (Db db = new Db()) { var pessoa = db.Pessoa.Find(1); if…
-
1
votes1
answer54
viewsA: Popular the properties of a class
An example class to load the return information json: public class Rootobject { public string CorIndicador { get; set; } public Dadosindicador DadosIndicador { get; set; } public int TipoIndicador {…
-
1
votes2
answers898
viewsA: Update with ajax in Laravel
The problem of accessing the route by the browser is that the method configured on the route only serves for Verb POST, but, there is the way a method responds to more Verb configured or up to all,…
-
1
votes1
answer43
viewsA: What is the correct order to inject dependencies into Laravel controllers?
In the builder, can be solved any dependency and does not have an order, but when the resolution is done by the methods the order is relative to the route parameters, which will always be after all…
-
1
votes1
answer136
viewsA: Get last Access column value
To know which was the last number inserted use the SQL SELECT @@IDENTITY and in your code it looks like this, example: provider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" datafile =…
-
2
votes1
answer2783
viewsA: Upload ajax jquery php
The best solution is to work with Formdata and build what is to be sent to your script PHP in case I switched to a better identification the name for id, I added one to one and then send it to the…
-
2
votes2
answers1065
viewsA: How to Paginate Data with Pagedlist in Asp.Net MVC?
One can do so, since the method GetAll() returns a IQueryable<T> has not yet been run by the bank and can quietly work with all the features outside: public ActionResult view(int? page) { int…
-
4
votes1
answer125
viewsA: How to set up an Anonymous Global Scopes in Laravel?
The Global Scope is an appeal contained in Eloquent to configure filters and restrictions for the Model in all consultations SQL that this model does. An example is logical deletion (Softdelete)…
-
2
votes2
answers33
viewsA: How do I pass this string in number to compute in another array?
Utilize parseFloat of javascript to convert from text to number, example: var alunos = new Array(); alunos[0] = new Array(); alunos[0] [0] = "Aline dos Santos"; alunos[0] [1] = "6,5"; alunos[0] [2]…
javascriptanswered novic 35,673 -
2
votes1
answer981
viewsA: How to name table pivot Many-to-Many
The question is, would the alphabetical order of the models or Migrations? At the end of the translation it says: translating Google Translator: The role_user table is derived from the alphabetical…
-
2
votes3
answers457
viewsA: How can I return zero in front of other numbers?
Utilize str_pad, to set zeros to the left and then concatenate the A again, example: <?php $texto = "A0001"; $novotexto = substr($texto, -4); echo $soma = 'A'.str_pad(($novotexto+1), 4, '0',…
-
1
votes1
answer258
views -
0
votes1
answer121
viewsA: Incorrectly formed foreign key retribution Migration
Missed putting unsigned in the submenu_id so that the migration is realized, because, the primary key of the table menu is created as unsigned which means that the field only accepts positive…
-
0
votes1
answer108
viewsA: Lib dependencies in C#?
The correct is the following: Do your Lib particular and add the dependencies to your project, after that your project to work needs the dependencies to be present, but each library maintainer is…
-
1
votes1
answer124
viewsA: Keep id and id_user equal on updateOrCreate
The code executed updateOrCreate is: public static function updateOrCreate(array $attributes, array $values = array()) { $instance = static::firstOrNew($attributes);…
-
1
votes2
answers3625
viewsA: Take the class and name of an Input
Can be used getElementsByName to pick up the elements with name="thiago" and then with the list of values take the value of the attribute .class with getattribute('class'), example: Javascript Puro…
-
0
votes1
answer12
viewsA: Error saving a collection of checkboxes
The error happens because, the same class instance variable name AutoExtras is the same name as the variable in foreach, just change the name of one or the other example: if( $auto->save() ) {…
-
3
votes2
answers66
viewsA: regroup values of an array into a new array
Well I’m not really sure, but, by the layout done is wrong, because inside each element created if it has an array of objects, then the layout would be more or less like this: { "season 1": [ {…
-
1
votes1
answer46
viewsA: Help with pg_fetch_assoc
Make a do-while, example: $row = pg_fetch_assoc($result); echo '<h1 style="text-align:center;">'.$row['no_unidade'].'</h1>'; $total = 0; do { echo…
-
3
votes1
answer42
viewsA: Question about the map function
I don’t know, if it really is necessary to create another layout of this information just to print, but, an example of how would be a way to apply this new data layout: var app =…
-
0
votes1
answer48
viewsA: How to make several separate selects with the 4.2 Standard?
You can use the addSelect as follows: if($month != 0) { $dbRegister = tb_data::selectRaw('tb_data.total_points'); } else { $dbRegister = tb_data::selectRaw('sum(tb_data.total_points)'); }…
-
0
votes2
answers345
viewsA: Problems with Laravel Query Builder
By the comments a Join done in the Builder is basically: $this join(string $table, string $one, string $operator = null, string $two = null, string $type = 'inner', bool $where = false) So in this…
-
2
votes1
answer1213
viewsA: Password registration with Hash in Laravel bank
Your code is wrong and you have invalid calls: When create is used, a array with the information that is configured in $fillable that model and also to generate the hash of the password was using…
-
0
votes6
answers6243
viewsA: check repeated number inside the array c#
If you want to use Linnum can also extract both information: Fetch items and do not bring repetitions: int[] array1 = { 2, 5, 8, 10, 2, 23, 2, 4, 5, 8, 8 }; int[] arraySemRepeticao =…
-
2
votes2
answers576
viewsA: Leave input to Focus after Alert
It had some coding errors, which was to take the value of the field and give a focus, that is, it does not represent the text box but the value contained in it, others however, was the way to use…
-
2
votes2
answers4641
viewsA: How to store a SELECT value in a MYSQL variable?
In the sql: select @userID := User_id from userdocuments where Description = @CPF; or select User_id into @userID from userdocuments where Description = @CPF;…
-
2
votes1
answer475
viewsA: Create Array using SELECT output
By the comments the Array is the type float with 5 rows and 3 columns SQL, an example: try { pst = conexao.prepareStatement(dadosGrafico); rs = pst.executeQuery(); float[][] items = new float[5][3];…
-
2
votes2
answers122
viewsA: I cannot filter array objects using Filter
The genres is a array then you need to sweep the positions for the id==3, example: var filmes = [{ title: 'Primeiro Filme', genres: [{ id: 10 }, { id: 15 }, { id: 21 } ] }, { title: 'Segundo Filme',…
-
1
votes4
answers1976
viewsA: Remove numbers at the end of a Regex string C#
The search for the end would be +$ with the search for numbers with more than 4 digits [0-9]{5,}, and the final expression also checking the space: "(\\s[0-9]{5,})+$": string nome0 = "0 - MARIA…
-
2
votes1
answer955
viewsA: Difference in hours between days using Carbon
Let’s create a minimal example, to exemplify and show what happens: In the first result that is the code print_r( \Carbon\Carbon::yesterday() ); Carbon\Carbon Object ( [date] => 2018-01-14…
-
1
votes1
answer208
viewsA: Grab all valuables from the database
Your initial code has typing problems and also lacks commands to work, a basic example of your code is: <?php $mysqli = new mysqli("localhost", "root", "senha", "dbname"); if…
-
3
votes1
answer167
viewsA: Use Laravel’s Crypt without using the framework?
To download the package use the command: php composer.phar require "illuminate/encryption" When used outside the framework Larable use your instance as follows: <?php include…
-
0
votes2
answers818
viewsA: C# Convert Dataset to JSON
An assumption without knowing the return becomes complicated to say, but let’s assume in a minimal example that this select (SELECT * FROM teste;) return two fields, the field Id and the countryside…
-
1
votes1
answer140
viewsA: Dropdown in the navbar
There was an error in where it was closed to function(), that is, a needless parenthesis the correct is in the example below: $(function(){ $('.dropdown-toggle').dropdown(); }); <script…
-
1
votes1
answer40
viewsA: I’m trying to dropdown html
Change your structures to these: Html <div class="form-group"> <label for="carro" class="col-sm-2 control-label">Carro selecionado</label> <div class="col-sm-10">…