Posts by novic • 35,673 points
1,265 posts
-
1
votes2
answers497
viewsA: Return result in a field
With this is your first time, you need to put all the information, for example, the <form>, but I ended up creating a minimal example: document.querySelector('#temp-form')…
javascriptanswered novic 35,673 -
2
votes1
answer644
viewsA: Entity Framewor Core Database.Setinitializer
It does not have this method that was previously used in the version Entity Framework 6.x, with the Entity Framework Core is used for the purposes of its context DbContextOptions…
-
2
votes1
answer34
viewsA: Code reduced to Insert
Yes, there is a way to pass one array associative in the eloquent as an example: $newarray = array( 'nome' => 'Carlos Bruno', 'login' => 'cbcarlos', 'senha' => '123456' ); the array only…
-
2
votes1
answer86
viewsA: Codeignite - Why doesn’t my route work?
If you want an optional parameter you must then create two route settings, the Framework has no other form (is limited in that respect), then do: Example: $route['xxxxx'] = 'Order/index';…
-
4
votes2
answers613
viewsA: Create shortcut of type 'prop' or 'propfull' in Visual Studio
Yes it is possible, this is called a code snippet or in English Snippet, install a Snippet Desinger (totally gratuitous) as the figure below accessed by the menu: Tools -> Extensions and Updates:…
-
1
votes1
answer79
viewsA: How to sort VARCHAR field in Codeigniter
In the last parameter of the method order_by place FALSE, so that the typed text is included without change in what was written, that is, the data will not be escaped, example:…
-
3
votes1
answer1545
viewsA: Position focus in a field of a modal window - Javascript and Asp.net MVC
If used Bootstrap put the settings in the event Shown.bs.modal, which will provide the focus in some element of modal when it is visible to the user, see example below:…
-
0
votes1
answer138
viewsA: Jquery3.2.1 Function Datepicker exists?
A minimal example: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/> <link…
-
0
votes1
answer45
viewsA: Is the writing of that function correct?
The DB::select is most used to return array values as you need to check if you have already registered an item by name use DB::table with where and finally the method calls the method count() as…
-
2
votes2
answers498
viewsA: Eloquent Laravel - Column user_id
An observer needs to be created where in the method before creating a new record (creating) can set a value for this model, a minimal example: Created a model inside the folder App by the name of…
-
2
votes1
answer78
viewsA: How to select only 1 record per month with SQL
The way I understand it if you want the minimum value of the date per month (which is the oldest purchase) of a given name, example: SELECT t1.id, t1.nome, t1.data_compra, t1.valor_compra FROM…
-
1
votes1
answer34
viewsA: Angularjs function is not respecting the condition!
There is an encoding error where the comparison variable was only making the comparison in the first and the rest not, to work you have to compare with all of the following way: if (nome ==…
-
2
votes1
answer142
viewsA: How to list data from one table, even the other (INNER JOIN) being empty?
In place of inner in the last method parameter $this->db->join place left, example: function get_processos_like() { $termo = $this->input->post('pesquisar');…
codeigniteranswered novic 35,673 -
1
votes1
answer1300
viewsA: Form select with Laravel
In his controller alter: public function create() { if (! Gate::allows('users_manage')) { return abort(401); } $marcas = MarcaCelular::pluck('nome', 'id'); return view('celulares.create',…
-
4
votes3
answers1243
viewsA: Merge all values at the same array level, at the same level
I don’t know a way Native to do this, so I made an example that solves this question: A very basic form is: <?php $data = array( 'A' => array(10,20,30), 'B' => array(100,200,300), 'C' =>…
-
3
votes3
answers1439
viewsA: Difference between SQL SERVER dates
You can use the function LEAD that accesses the subsequent line data, that is, this function used in the SELECT server to compare the current line with the values of the next line SELECT…
-
1
votes1
answer176
viewsA: Group json with PHP?
First, you must take this information and turn it into a array, then make a repeat loop to assault this information, in which case I put the id as key, and then return that JSON you want, example:…
-
2
votes3
answers5888
viewsA: Difference between the create and Fill method - Standard
The first example of code, creates an instance of the class and takes the data passed and writes //instancia uma classe Produto //método atribui os valores configurados no fillable //grava um novo…
-
0
votes2
answers985
viewsA: Error Laravel migrate
Put a size in the field $table->string('email that will solve the problem, he complains that the size of the field is very large in the creation of the Indice, example of correction that in my…
-
1
votes1
answer57
viewsA: How to use ORDER BY for a data that does not come from the Bank?
With some modifications to your code and using the function usort if you have a sort by the desired field, example: <?php $item = array( array('86015-810', '86830-000'), array('86015-820',…
-
1
votes1
answer28
viewsA: View ngRoute array data
I would use with rootScope as follows: <!DOCTYPE html> <html ng-app="myApp"> <head> <title>Projeto</title> </head> <body> <ng-view></ng-view>…
-
1
votes1
answer86
viewsA: Auth::loginUsingId does not work on Lumen
In the archive bootstrap/app.php should be commenting on the use of Facades in the Lumen then strip the line like this: is like this: // $app->withFacades(); // $app->withEloquent(); uncouth…
-
1
votes1
answer247
viewsA: How to include files in a View based on the Laravel Route?
The Route::has checks if there is a route with this name in the route settings, does not define exactly what is the current route being used, for this there is the currentRouteName() method that…
-
1
votes3
answers636
viewsA: Object Reference not set to an instance of an Object. - Json
Its classes have properties that are complex (classes) then they need to be instantiated, so that you have access to their innermost properties, look at the changes: public class Name { public…
-
0
votes1
answer440
viewsA: Validation Message - ASP.NET MVC
The problem is quite simple, you have a class of entity: public partial class Medicos and created a class partial: public partial class Medico That is, it is not the same entity class, so put a s at…
-
1
votes1
answer307
viewsA: How to find the last 5 images inserted in the seat and show in a carousel?
To return the last record of a table with eloquent we must have an ordination, I believe that by id of the auto increment record already solve, another caveat is that used the wrong technique,…
-
3
votes1
answer80
viewsA: When using back() in the Laravel this should be preceded by redirect()?
These are two ways of doing the same thing, namely, redirect to the previous location and are functions that return the class instance Redirector and its main objective is to facilitate the…
-
2
votes1
answer72
viewsA: Is it possible to obtain a parent attribute when the class defines the child attribute?
From what I understand, you want to, get into the class instance GrandpaAttribute, for test reasons I added a property First for the test to be performed, first the real instance is sought, and then…
-
0
votes1
answer105
viewsA: Retrieve Listview values - Getelementbyid
Set it up like this? function controle(obj) { var outros = obj.textContent; alert(outros); } <label onclick="controle(this);">Número 1</label><br /><br /> <label…
-
1
votes1
answer54
viewsA: FETCH_CLASS does not arrow parent class values
Simple to your SQL does not bring the fields that are of its base class, note, that I changed a little its code and has only discriminated the fields of 4 fields (u.id, u.nome, c.nome AS curso,…
-
1
votes1
answer69
viewsA: View does not show string value in the primary key field
Next, the eloquent works like this: the primary key in the default convention is an auto number increment so when showing the result the field is subjected to an integer conversion, but as the field…
-
0
votes3
answers587
viewsA: How can I sort a result in Laravel with a custom attribution from my model?
You cannot use data computed in SQL from your database, but you can use twice the orderBy and solve this problem as follows: $users = User::orderBy('first_name') ->orderBy('last_name')…
-
1
votes2
answers54
viewsA: Unserialize data in Codeigniter?
To access the key tree_funcao, must first use a json_decode, (because, as far as I can tell, it’s a json) that will return a array associative, after that access key tree_funcao and use unserialize…
-
0
votes1
answer1800
viewsA: Help with error Trying to get Property of non-object Laravel
Always use early loading, because, it generates only 2 SQL and with that there is no performance loss, example of the modification: public function index() { $cursos =…
-
0
votes1
answer83
viewsA: Mongodb Objectid returning [Object Object] in Ajax
From your comment, you realize you’ve had a hard time understanding, this JSON is actually a array information, ie has positions for each item, example: let item =…
-
4
votes1
answer261
viewsA: PHP 7 Syntax error, question mark before specifying the parameter
The version does not match the new feature called Nullable types which has been introduced in the version 7.1, then the 7.0 does not have this feature so of the mistakes. Reference: Nullable types -…
-
2
votes5
answers1602
viewsA: Change return /Date(1386295200000)/ to date format
The best option in this case is inherit the class JsonResult and change the date format setting as follows: Class JsonResultDateFormat: public class JsonResultDateFormat : JsonResult { public…
-
2
votes1
answer247
viewsA: Remove MVC URL parameter name
To mount a specific route is as follows: routes.MapRoute( "vlog_usertimeline_slug", "/vlog/usertimeline/{slug}", new { Controller = "Vlog", action = "UserTimeline", slug = UrlParameter.Optional } );…
-
0
votes1
answer479
viewsA: Group By Days Laravel Eloquent
You need to fetch the key and then the collection of the key: @foreach($messages as $key => $message) <li class="time-label"> <span class="bg-red"> {{ $key }} </span>…
-
1
votes1
answer72
viewsA: Mutator as Standard Attribute
To add a field the technique used is serialization. You really need to create a accessor as you created it yourself, but you need to tell your model one more configuration: protected $appends =…
-
3
votes1
answer61
viewsA: Two actions for the same View
I can’t add two action to a same view? Yes CAN, just specify the name of your View in both Action, example: public ActionResult Lista(int PessoaId, string Nome, string Twitter) { Pessoa p = new…
-
3
votes1
answer39
viewsA: Is there any way to run an event whenever the Sqlconnection.Update method of Dapper.Contrib.Extensions runs on an entity?
The Dapper does not have this feature to make this change, so do it directly in the class property, every time you change the property Campo1 by the code is also amended Campo2, example: public…
-
3
votes5
answers73
viewsA: Calculate date difference and print these days
You can interact on the two dates with a simple for, the class Datetime, there is a way add which may be inserted a Dateinterval for a new date with a value in your constructor P1D, that is, one…
-
0
votes1
answer23
viewsA: Pull Characters from a column in the datagridviwer
Basically: string cpf = $"{dgw_cadastro.Rows[i].Cells[4].Value}".Replace(".","").Replace("-","."); cadastro.Parameters.AddWithValue("@CPF", cpf); note that the .Value is the type object and to…
-
1
votes1
answer193
viewsA: Map Object value to Entity Core
To map in Entity Framework Core is different, the resource used is Property types (Owned types), a basic example for your question: The two Entities: public class People { public int Id { get; set;…
-
1
votes1
answer328
viewsA: Laravel Validator require
Here comes the question, but I did not set require, the validator should not let go? The answer is no because in the documentation itself there is an excerpt that answers your question: string The…
-
0
votes1
answer167
viewsA: Validate when the value is "Selected" Dropdownlist with Jquery.Validity
Create a method to verify the value of the option chosen, in the case of this example, the field drop1 has a option with the value ="" then in the function was verified that value:…
-
4
votes3
answers328
viewsA: Format integer value in "000" format
To work, here are 2 examples (one with Padleft and the other with string. Format): int i = 1; Console.WriteLine($"{i}".PadLeft(3,'0')); Console.WriteLine(string.Format("{0:000}", i)); ONLINE EXAMPLE…
-
1
votes1
answer84
viewsA: Doctrine prepare->execute
How are you using the prepare of the PDO (because Doctrine is made with PDO), then make these modifications to your code: $stmt = $em->getConnection()->prepare(" SELECT…
-
7
votes3
answers94
viewsA: Make a function that shows whether the number is integer or not
Basically use Number.isInteger, example: // Returns true console.log(Number.isInteger(100)); console.log(Number.isInteger(-100)); // Returns false console.log(Number.isInteger(Number.NaN));…