Posts by novic • 35,673 points
1,265 posts
-
0
votes1
answer289
viewsA: Error validating date with Carbon?
When using this command it needs to be checked if there has been an error with the method getLastErrors() that by that date informed 06/17/2010 has the following result: >>> $data =…
-
0
votes1
answer301
viewsA: Laravel - how to save if there is a change in the model
This is the code of the method save() of Laravel version 5.3 public function save(array $options = []) { $query = $this->newQueryWithoutScopes(); // If the "saving" event returns false we'll bail…
-
0
votes1
answer772
viewsA: Laravel - Hasone 5.8
The relationship by Migration added in the last edition credits to say that the relationship is 1 for many where areas and users has several profissionais and profissionais has a area and a usuario…
-
3
votes4
answers1546
viewsA: Take specific value from a JSON or XML
Edited the question and closing that XML that came wrong stands as an example: XML: <?xml version = "1.0" encoding="Windows-1252" standalone="yes"?> <VFPData> <xsd:schema id="VFPData"…
-
0
votes2
answers70
viewsA: Choose path index
This setting by default (i.e., the RootDirectory is configured for the folder /Pages) and configures your pages are inside the folder /Pages and follows a convention where the subfolders have the…
-
1
votes1
answer199
viewsA: Problems saving decimal value in Database (Laravel + Postgres)
If you send from the screen: R$1.500,99 need to use the str_replace as follows: function parse_money($number) { return str_replace(['R$','.',','],['','','.'], $number); } that is, you need to…
-
2
votes1
answer104
viewsA: Laravel sort items from one table from the values of another
Can do in the inverse of the relationship and first seek to group the propostas_itens and with the command with call the relationship of proposta, example: App\PropostaItens::groupBy('proposta_id')…
-
1
votes4
answers109
viewsA: Using the existing key_exists array
Response code in the OSen: Check if specific array key exists in multidimensional array - PHP function findKey($array, $keySearch) { foreach ($array as $key => $item) { if ($key === $keySearch) {…
-
0
votes2
answers45
viewsA: Plan properties in a single table
Yes it is possible, you have to map the fields all in the same class configuration Pessoa, but, this has to be done by the configuration class and configuring the method OnModelCreating as follows:…
-
0
votes2
answers3478
viewsA: How do I clean Input after saving the data?
After using the values just change the value with this.setState({name:''}), example: class App extends React.Component { constructor(props) { super(props); this.state = { name: 'algum valor' }…
react-nativeanswered novic 35,673 -
0
votes1
answer432
viewsA: Laravel 5.8 - Create custom validations to use on a Formrequest?
To create a validation in this way create a class to validate this process, which has the following code: Verify Cnpj: <?php namespace App\Utils; class CnpjValidation { public function…
-
0
votes1
answer124
viewsA: Laravel - Inserting & Updating Related Models
As you have already made an object and called the method save() returning true if the data is saved line after with find is not necessary because you already have one Person that needs,…
-
2
votes1
answer169
viewsA: Jquery validation input Multiple file
You need to take the array archival ($('#arquivoXml')[0].files) and check one by one until finalized as being all of that kind stipulated by the code, example: ; (function($) {…
-
0
votes2
answers700
viewsA: How to pass a touch event via props to a child component?
Basically that’s how: class Pai extends React.Component { onEventClick() { console.log('clicado'); } render() { return ( <div> <h3>Pai</h3> <Filho…
-
2
votes1
answer150
viewsA: Logging in to Laravel password without hash
If you can use, authentication by the instance of the user you search for email and then compare the password. Remembering how you yourself reported, the password in this way is very problematic.…
-
3
votes1
answer774
viewsA: Take column name with foreign key
What is missing really in your question are the relations of your two tables, and also the Models which are configured for these tables, where a Produto has Categoria and a Categoria is in several…
-
3
votes2
answers75
viewsA: How to modify an object array through a condition?
And something like that, I think it solves your problem, where it was split in two array of objects the items you have parent and not and then made the junction with filter, example: // matriz let…
-
2
votes3
answers73
viewsA: Mark All Checkbox in a groupbox
In the search button this GroupBox (in my case is groupBox1) and take your controls which are of the type CheckBox (Cast<>) and make a ForEach setting up your property Checked = true, example:…
-
1
votes1
answer31
viewsA: How to set date type in JS
It worked for me that way: document.getElementById("data").value = '2005-05-15'; <input type="date" id="data" name="data" />…
javascriptanswered novic 35,673 -
2
votes1
answer277
viewsA: Check if cookies exist in ASPNET CORE
Just do like this: if (!string.IsNullOrEmpty(Request.Cookies["EstaAtivo"])) { Response.Redirect("~/garantido"); } else { Response.Redirect("~/entrar"); } because the Request.Cookies["EstaAtivo"]…
-
1
votes1
answer46
viewsA: Using the Array_map Function
You need to call twice array_map, one that will iterate on the arrays and the other who will call the function to strtoupper, example: <?php $array = array ( array('name' => 'a'), array('name'…
-
1
votes1
answer317
viewsA: Instances of Singleton Asp.Net Core classes
Basically this is a standard class Singleton: public class Singleton { protected Singleton() { } // não tem instanciação pelo construtor private static Singleton _singleton; public static Singleton…
-
1
votes1
answer66
viewsA: What is the difference between Eloquent Model::get() and Eloquent Model::all()?
Everything is get(), that is, the method all() of Model flame get(), code that exemplifies the statement: public static function all($columns = ['*']) { $columns = is_array($columns) ? $columns :…
laravel-eloquentanswered novic 35,673 -
1
votes2
answers108
viewsA: Check if call came from API (.Net Core) or MVC
Propose for your code, a package that has in its code particularities being that the version of the project makes reference to its current model of its two projects ASPNETFULL and ASPNETCORE as…
-
1
votes1
answer56
viewsA: create a Pre (ETL) Extract, Transform, load with console c#
Basically reads the main file (with the class Streamreader) and with the command Substring of the line which is of the type string makes a comparison of the first position by finding out if the line…
-
0
votes2
answers245
viewsA: How to make a Class property of another Class? C#
To access a class member you need to first create your instance, and the message itself says: Undefined object reference to an object instance, but, as it would be in practice: Classes public class…
-
1
votes1
answer51
viewsA: Protected Friend in Vb.Net: the field is also visible in other projects
On the Microsoft website itself talks about the subject: Protected Friend (Visual Basic) Protected Friend keyword combination is a member access modifier. It confers both friend access and protected…
-
1
votes1
answer46
viewsA: How to ignore the default Model $with in Laravel (Eloquent ORM)
Develop a Scope to remove from the early interface the item or items: public function scopeNoEagerLoadsExcept($query, array $items) { if (count($items) == 0) { return $query; } $eagerLoads =…
-
3
votes2
answers504
viewsA: Laravel 5.8 - Can we make Sync in a pivot table without the id field?
Laravel 5.8 - We can do sync in a table pivot without the field id? The Eloquent ORM Framework contained in Laravel has this command Sync which has in its documentation the following text: Using…
-
3
votes2
answers664
viewsA: Check if CPF already exists with Jquery Validate
Usually this return is produced as an example? json_encode(array('existe' => 'true')); so that the code of jquery.validation understand in the validation configuration remote need to read this…
-
1
votes2
answers2230
viewsA: PHP Nfe 4.0, how to view invoice information?
Use the function simplexml_load_file (directly already plays the role of the two you are using) and when you want debugar a code do so: <?php $xml= simplexml_load_file("nfe.xml"); if (!$xml) {…
-
2
votes2
answers42
viewsA: How to load Enum property into a Lambda
The way is to compare with the Enum CustomerTypeRequest which is the type that is configured in your Template: var qry = customer.Where(x => x.Type == CustomerTypeRequest.Customer);…
-
2
votes1
answer420
viewsA: How to translate "Errormessage" from a "Custom Attribute"
You need to add the settings in the constructor, or in the attribute configuration, in the constructor: //base.ErrorMessageResourceName = "/*nome da chave*/" ou base.ErrorMessageResourceType =…
-
0
votes1
answer123
viewsA: Problem with JOIN in Laravel
If you change the primary key to another name has no problem, but, what happens is that the relationship keys you need to configure (exists at the Laravel convention, when you change it, the keys…
-
2
votes1
answer868
viewsA: new stdClass continues showing Warning "Creating default Object from Empty value"
The code you made also lacked say that members (get and post) is also the type \stdClass? <?php $obj = new \stdClass; $obj->get = new \stdClass; // faltou isso $obj->post = new \stdClass;…
-
1
votes3
answers459
viewsA: How to make two WHERE clauses inside a nested WITH
A very clear example on the site is that you can use in advance charge conditions, example: $users = App\User::with(['posts' => function ($query) { $query->where('title', 'like', '%first%');…
-
1
votes1
answer137
viewsA: Jquery validation using array in the Names input?
You need to put the name between double quotes in your case for validation to occur because it is a different type from the standard, example: $(document).ready(function() { $("#form1").validate({…
-
2
votes1
answer135
viewsA: Error while using Middleware
The solution is to inject in the method invoke public class RedirectNoCondominium { private readonly ICondominiumService _condominiumManager; private readonly RequestDelegate _next; private readonly…
-
1
votes1
answer85
viewsA: Why can’t I overwrite a Collection in Laravel using the values() function?
Everything you said is true and the solution is the same for the Laravel version 4.2: The void method forget removes an item from the list by its key, its code is: public function forget($key) {…
-
4
votes1
answer180
viewsA: Custom Data Annotations for validation
Basically you need to create a Middleware, that when checking your code whether or not a condominium exists makes the redirect. Example: Create a class: public class RedirectNoApartment { private…
-
1
votes1
answer104
viewsA: Problem with Bindvalue and PDO
To solve your problem you need to put the percentages in the variable and not in the instruction parameter SQL, example: $comando = $conexao->prepare("SELECT * FROM usuario WHERE nome like…
-
1
votes1
answer152
viewsA: View related table information - Laravel?
The answer is as follows: In his Controller put the load in advance with the method with, because in this way two SQL only and with it has a better performance than the delayed loading that at each…
-
1
votes3
answers38
viewsA: How to instantiate Webheadercollection using object initializers?
It can be done like this: WebClient client = new WebClient() { Encoding = System.Text.Encoding.UTF8, Headers = new WebHeaderCollection() { ["APIKey"] = "APIKey", ["APIKey1"] = "APIKey", } }; because…
-
6
votes2
answers134
viewsA: Comparison of array in php
You need to pick up each position and check with array_diff what is the difference of the other array and create a new array with these differences, example: <?php $array1 = array(array(1,2,3),…
-
2
votes1
answer1927
views -
0
votes1
answer95
viewsA: Eloquent Laravel 4.2 setting Null at equal values
I was really confused when you posted a method that is already implemented on ORM Eloquent and does not work. Now observing well you did not follow the naming of names that the Laravel leaves as an…
-
1
votes1
answer260
viewsA: How to call a class method in webforms code-Behind?
I propose a solution: Pilha Class: public class Pilha { public Pilha(string elemento) { Elemento = elemento; } public string Elemento { get; } } Page code: protected void Page_Load(object sender,…
-
1
votes2
answers242
viewsA: Codeigniter database information array
Change your code, because really you are doing wrong, ie instead of passing the values to the array, you are returning only the result, example: public function getRecibos($codigosRecibo) { $result…
-
3
votes1
answer31
viewsA: Convert normal numbers to date
Yeah, basically what a date, utilize date_create_from_format to create an object of the type Datetime if the data is valid if it does not return bool(false) for invalid data, example: $data =…
-
3
votes2
answers558
viewsA: Check values within a JSON
A simple way, find the keys to this json (which is a dictionary of values) and after that an interaction to find or not the value that was asked and in the end present true or false contained in…