Posts by Wallace Maxters • 102,340 points
1,984 posts
-
5
votes1
answer736
viewsA: You can access the key through the value:
The dict has no native method for this. But there is a maneuver that can be done. You can use the method values, that will return a list. Then you take the index of this list and get the values of…
-
2
votes1
answer403
viewsQ: How to know if a particular column exists in a table in Laravel?
I wonder if there is any way to know if a column exists or not in the Laravel. For example, I want to sort data from the query string. If the value "column" exists in the table, then I sort by this…
laravelasked Wallace Maxters 102,340 -
8
votes3
answers19310
viewsQ: Alternatives for developing in C# on Linux?
My notebook has installed the Ubuntu 14 operating system. I have great desire to enter the development in the language Csharp. But I wonder if there is a good alternative in OS like Linux, since it…
-
1
votes1
answer4611
viewsQ: How to add a Foreign key with Migration?
I’m learning now how to use the Migrationof Laravel. I managed to understand well the functioning, but still do not know how to add a foreign_key I have the following Migration:…
-
4
votes1
answer4772
viewsA: Create session variable when logging in - Laravel
In the Laravel 4, to use the sessions, you must use the class Session. Then I will show what each method does in relation to that class: Session::put - Adds one or more values in the session. You…
-
1
votes1
answer892
viewsA: Sort a search result with filter
I already understand what is happening. As you are using the form, only the data present in this form will be sent to URL. Usually I don’t use forms to create Ordenação, but only Links in table…
laravelanswered Wallace Maxters 102,340 -
2
votes1
answer124
viewsA: What exactly does the Pdostatement::bindColumn() method do?
Serves to assign the value of a column of your Select to a variable. Note that in the documentation there is a very detailed explanation of this, but to understand you must be familiar with the…
phpanswered Wallace Maxters 102,340 -
3
votes1
answer770
viewsA: The best way to organize menu and footer in php is with includes?
Carlos, basing my knowledge on working with frameworks, I suggest you build a structure to work better with PHP. For example, I think you should organize your project by separating everything into…
phpanswered Wallace Maxters 102,340 -
0
votes1
answer167
viewsA: Branch removing files from the master branch
Well, I’d do it this way: git checkout branch_que_quero_dar_o_merge git checkout branch_em_que_quero_arquivos -- pasta/ou/arquivos Thus, if the merge is deleting some file, you can just pick them up…
gitanswered Wallace Maxters 102,340 -
16
votes3
answers4507
viewsQ: What is the point of "interrogation" in the type statement in C#?
I saw this code written in C# on the Internet: namespace Test { [MicroEntitySetup(TableName = "Users")] public class User : MicroEntity<User> { [Key] public int id { get; set; } public string…
-
12
votes2
answers815
viewsQ: How does the logic of Where in the Entity Framework work?
I’m studying C# and I just made my first query in the Database: using System; using System.Data.Entity.Core; using System.ComponentModel.DataAnnotations; using…
-
0
votes3
answers2390
viewsA: How to access a list resulting from one function in another?
The best solution in my view when it is necessary to use a given function in another is: or use the return or use the passage of arguments to do so: Example using the passage of arguments: lista =…
pythonanswered Wallace Maxters 102,340 -
10
votes1
answer975
viewsQ: What differentiates a microframework from a full stack framework?
I see a lot of terms around Fullstack framework when it comes to frameworks like Codeigniter, Laravel, Symfony and Cakephp (from PHP) and Django (from Python). But when you talk about Silex and…
-
5
votes3
answers878
viewsA: sort multidimensional array php
Well, I think I’d do it this way. Just use the function usort. usort($dados['dataTable']['lista'], function ($a, $b){ return strcmp($a['fields'][0]['name'], $b['fields'][0]['name']); }); The…
-
1
votes2
answers222
viewsA: How to include values in the same Section without overwriting the previous one?
Simply and directly, all you have to do is stop using the @stop at the end of his statements and move to using @append. Although I didn’t see anything in the documentation about it, the class…
-
19
votes3
answers1592
viewsQ: What is System.Linq for?
I asked that question here at SOPT What is the equivalent of PHP’s C array_map#? And I was curious to know what this is about System.Linq. Because when I tried to use the answer code above without…
-
5
votes1
answer92
viewsQ: What is the equivalent of the PHP array_map in C#?
In PHP, can create a new array based on a array already existing, using the function array_map. With it, I can define a callback that is responsible for the definitions of each value that will be…
c#asked Wallace Maxters 102,340 -
1
votes1
answer241
viewsA: Is there any way to define a specific title on Laravel routes?
Yes, with a little creativity you can create "custom attributes" on Laravel. I mean by that you can create indexes on array passed to the route. My suggestion is to do this with indexes that are not…
-
0
votes2
answers222
viewsQ: How to include values in the same Section without overwriting the previous one?
I have a view which includes another view . I want these same views to include a javascript in view main call javascripts. Thus: #layout.blade.php <head>@yield('javascripts')</head>…
-
3
votes1
answer468
viewsQ: Why use unless in Laravel instead of a no if denial?
I think the Laravel an interesting framework. The features of the view are excellent, regarding the simplification of the syntax of a foreach or iffor example. But still one thing I don’t understand…
-
1
votes1
answer241
viewsQ: Is there any way to define a specific title on Laravel routes?
In the Laravel 5, I am creating a menu dynamically, making a foreach in the list of registered routes. So I can have a menu displayed each time a new route is created, but I’m only listing the ones…
-
3
votes1
answer89
viewsQ: If fclose closes a file, how do you close an open file with the Splfileobject object?
When we open a file with fopen, we use the function fclose to close the file handler. $handle = fopen('file.txt', 'r'); fclose($handle); But my curiosity is: And when we use the object…
phpasked Wallace Maxters 102,340 -
3
votes1
answer353
viewsQ: Is there any way to discover an error occurred in json_decode?
Well, PHP has one thing I sometimes consider bad: Some functions launch Warning when some error occurs, and already others, return False or Null. A case that exemplifies this is the fopen.…
-
1
votes1
answer607
viewsA: Format En date controller
I would do as follows, using the class Carbon\Carbon. $data_inicio = Carbon\Carbon::createFromFormat( 'd/m/Y', $request->get('dataini') ); I would refactor the code in relation to the query to be…
laravelanswered Wallace Maxters 102,340 -
4
votes2
answers142
viewsQ: How can I format this array to the way I want it?
I’m creating a Seeder to the Laravel insert values into a table N para N. I am riding the array in one way, but I need it to "become" in another. This is because I want to avoid repeating constant…
-
2
votes3
answers1837
viewsA: Get back deleted files in Git
I think I’d use that command: git reset --hard HEAD
-
14
votes2
answers877
viewsQ: Is there a specific rule for commit messages in versioning systems like Git?
The people here where I work, for a certain period of time, used to not care about the messages that they wrote when making a git commit around here. It seems that Git was simply "a place to save…
-
1
votes1
answer388
viewsA: Pick up zip in another bank in Laravel 5
You can configure more than one database on Laravel. Example: 'mysql' => array( 'driver' => 'mysql', 'host' => 'host', 'database' => 'database', 'username' => 'srvweb', 'password'…
-
7
votes5
answers10575
viewsA: Subtraction of hours in php
You can also use a library called Wallacemaxters Timer to do this: use WallaceMaxters\Timer\Time; $t1 = Time::createFromFormat(Time::DEFAULT_FORMAT, $tempo1); $t2 =…
phpanswered Wallace Maxters 102,340 -
1
votes1
answer183
viewsA: How to return difference after running update on Laravel 4?
To do this you can make a "small maneuver" using the method getDirty. This method serves to bring the attributes that were changed before the model update. So you could do like this: $usuario =…
-
4
votes2
answers7856
viewsA: How to get the GET value in Laravel, even when the request method is POST?
Come on, I’ll answer my own question, but don’t get it wrong, I just want to help some people who are interested to learn more about the Laravel. When you want to take the values referring only to…
laravelanswered Wallace Maxters 102,340 -
4
votes1
answer117
viewsQ: Why do some libraries start with version "0.6" or "0.2" instead of using "1.2" or "1.6"?
Well, here at Stackoverlow I could learn about Versioning. When incrementing the version using Semantic Versioning? Versioning scheme I was able to understand perfectly the versioning scheme, and…
versioningasked Wallace Maxters 102,340 -
2
votes2
answers7856
viewsQ: How to get the GET value in Laravel, even when the request method is POST?
I’m making a request for a route, where the request method is marked with the Any - that is, accepts any method. public function anyIndex() { $nome = Input::get('nome'); $id = Input::get('id'); //…
laravelasked Wallace Maxters 102,340 -
0
votes1
answer789
viewsQ: How to make requests with Http Guzzle pretending to be "AJAX"?
I usually use the libraryGuzzle\Http to be able to request some urls with PHP. I’m webserving with our systems, where, if the request is recognized as Ajax, the returned result is Json. Otherwise it…
-
8
votes1
answer1510
viewsQ: Is there any way to test a route using PHP Unit in Laravel?
I love to create using the PHPunit to create unit tests for my libraries. Always, before doing the git commit, run it to see if any changes affected what was previously working. I wish I could also…
-
22
votes1
answer29792
viewsQ: Set up Cronjob to run every 5 minutes, when it’s between 5 to 20 hours
I need to make a configuration so that mine cronjob function every 5 minutes. However, if the time of day is before 5and greater than 20 I don’t want you to spin. I mean, I want a make one cron…
-
0
votes1
answer518
viewsA: How to get the table name of a model?
To get a model’s table name just use the method getTable, which is inherited from Eloquent. $tabela_usuarios = (new Usuario)->getTable();
laravelanswered Wallace Maxters 102,340 -
0
votes1
answer511
viewsQ: How do you instantiate a class in php using an array as argument (equal to call_user_func_array)?
In php, when I can invoke a function, using a array as if I were passing each argument in sequence. Example: function soma_a_b($a, $b) { return $a + $b; } If I had an array with two elements, I…
phpasked Wallace Maxters 102,340 -
0
votes1
answer518
viewsQ: How to get the table name of a model?
I need to get the table name that is used by determined model in my written application in Laravel. In the past, in the Laravel 3, it was only necessary to do this to find out the table name:…
laravelasked Wallace Maxters 102,340 -
1
votes1
answer188
viewsA: What is the "url" option in the app/config/app.php configuration file.
As far as I know, this setting is intended to define the base url of the application when it is not possible to detect it automatically. A basic example of this is command line execution. Consider…
-
0
votes1
answer188
viewsQ: What is the "url" option in the app/config/app.php configuration file.
In the Laravel 4, we have a configuration file app/config/app.php. There is an option called url. Many times I’ve seen this empty option: 'url' => '', And I also did the test to put some url…
-
4
votes1
answer946
viewsA: Condition in request Condition
Yes, I usually do that a lot in the Laravel 5. public function rules() { $rules = ['nome' => 'required', 'email' => 'required|email']; // Se o valor da checkbox for marcado if…
-
4
votes1
answer173
viewsA: How to Sort Related Model Data?
In Laravel it is possible to pre-load the results of the relationships of a particular model. Thus, along with this upload, you can also add conditions that will be applied to the relationships that…
-
0
votes3
answers1218
viewsA: How does Laravel "guard" the routes?
Well, let’s explain in parts: The Laravel, when we use the class call Route, Actually you’re calling a class facade Illuminate\Routing\Router. A Router serves to facilitate the creation of routes…
-
1
votes3
answers1218
viewsQ: How does Laravel "guard" the routes?
In the Laravel, both in 4 and 5, we can use a class called Route in order to create certain routes. My curiosity is: how does the Laravel (or other frameworks) do to "know" which given route…
-
-1
votes1
answer265
viewsQ: What is the KEY used in frameworks for?
Generally, when I see systems that have been made without the use of frameworks, there is no use of keys. However, all the frameworks I have used to date, all of them you need to define a key (key)…
-
1
votes2
answers464
viewsQ: How to replace a specific query string value of a url through PHP using an array?
I have the following url that is returned to me by a webservice in a certain part of my application. But it comes with a query string that determines the size of the image (according to the…
phpasked Wallace Maxters 102,340 -
0
votes2
answers94
viewsA: Save Related Models (One to One) - Laravel 5.1
I’m pretty sure you can do it like this: $info = Info::findOrFail($id); $info->complemento->fill($request->all())->save();
-
2
votes2
answers1625
viewsA: How to know the current route on Laravel 4?
Very good, Mr @Wallacemaxters! That’s very simple. Just use the method Route::getCurrentRoute(). It is first important to remember that this will only work in filters and in the App::after. In the…
-
11
votes1
answer413
viewsQ: "Referer" or "Referrer"? Is that a spelling error or is that correct?
Honestly, I’m in tremendous doubt right now. I just gave that answer here at stackoverflow: /a/123445/4995 In this answer, I teach that, to refer to the previous page, we should use the variable…