Posts by gmsantos • 17,221 points
395 posts
-
1
votes1
answer2689
viewsA: How to access the local host from a Docker container?
There are two ways you can do this. One is you run SQL Server from a container. You can run it from a Linux container including: Quickstart: Run the SQL Server 2017 container image with Docker The…
-
3
votes1
answer1263
viewsA: What is the default value of MAIL_ENCRYPTION in Laravel 5.6?
In that case it shall be as defined in .env (null). > php artisan tinker Psy Shell v0.8.17 (PHP 7.0.26 — cli) by Justin Hileman >>> config('mail.encryption') => null To use the…
-
2
votes1
answer746
views -
0
votes2
answers719
viewsA: Bring repeat records from 3 columns in the same table
You can make a query per column, join all in one query UNION, sorting and grouping the result: SELECT * FROM ( SELECT valor1 AS valor FROM tabela UNION ALL SELECT valor2 AS valor FROM tabela UNION…
-
4
votes1
answer1599
viewsA: Save files with storeAs out of Storage folder
The third argument of storeAs tells you which one Storage disk the file must be saved $path = $request->photo->storeAs('images', 'filename.jpg', 's3'); So create a new disk in…
-
2
votes1
answer357
viewsA: Over redirect in Codeigniter
Your check is done on your /? If yes you are entering a loop infinite when redirecting back to / if the user is not logged in. Instead of redirecting to /, send to the page of /login instead and…
-
6
votes1
answer5527
views -
0
votes2
answers798
viewsA: How to create a scheduled task
This is not a command that runs on the terminal. You need to put this command on the cron of your server. To do this run on the terminal crontab -e A file will be opened. Here yes you put the…
-
3
votes5
answers2297
viewsA: Store IF output in a variable to use later
If you want you can store the result of the comparison in the variable $os. Since the assignment operator is associative to the right, it will return a Boolean with the result of the comparison. if…
-
1
votes1
answer19
viewsA: Include comma in results from the database
While you iterate, save the colors in another variable: $sqlEstoques = mysqli_query($this->conexao,"SELECT * FROM loja_estoques WHERE IDProdutos = '".$jmBusca->IDProdutos."';");…
-
3
votes1
answer210
viewsA: Data Recovery Problem in a Portable Application
You are using the wrong function. After running the query in the database, the function pluck will transform your result as a array where the first field is the value and the second is the key.…
-
1
votes1
answer505
viewsA: Update in two SQL Server tables
Among its tables, which has the primary key? If it is tarid, create the Foreign key with VinculoReferencia as Scade on update, thus while updating tarid, Taridinclusao will also be updated. ALTER…
-
1
votes2
answers1185
viewsA: How to Read this json with PHP
By default the json_decode returns a stdClass and for your access it is not possible to use the foreach. On the other hand you can do json_decode return an array, which in turn is eternal. In this…
-
1
votes1
answer49
viewsA: How to modify all PHP7 error messages?
It is possible to define a Exception Handler to manipulate all exceptions or errors not dealt with set_exception_handler, just pass any callable for him: set_exception_handler(function ($e) { echo…
-
0
votes2
answers1212
viewsA: How to pass parameters to the Resource controller directly from the View with Helper url()
There are two other ways you can do this: Url from a named path (the Resource already does it for us too) echo route('tags.edit', ['id' => 1]); // http://example.com/painel/tags/1 Url from the…
-
1
votes1
answer167
viewsA: Sql server 2016 Developer x 64 Setup.exe Error
Researching what may be happening I found this question: https://stackoverflow.com/questions/23164506/error-with-no-information-when-installing-sql-server-2012-on-vmware-virtual-serv Apparently it…
-
6
votes1
answer100
viewsQ: What is the use of default interface methods?
I was seeing some features proposed for C# 8 and came across the default interface methods. Add support for virtual Extension methods - methods in interfaces with Concrete implementations. From what…
-
5
votes1
answer838
viewsA: Foreach within Foreach PHP
You can do it like this: $fetch = $twitterusers->selectUserAll(); foreach ($fetch as $row) { $usersIds[] = $row['id']; } var_dump($usersIds); Or better yet, without having to iterate with…
-
1
votes2
answers165
viewsA: Order of execution of unit tests
Your problem is not in the order of execution, it is in the method tearDown. Phpunit will execute the methods setUp and tearDown after each execution class method. As his tearDown is giving a…
-
5
votes1
answer711
viewsQ: Create a patch from a commit
When executing the command git apply it is possible to create a commit with changes from a text file: git apply ~/Downloads/patch.txt How do I create this patch from a commit existing?…
-
2
votes1
answer2066
viewsA: Mysql does not install
It seems to be unavailable on the Microsoft site version 2013. I do the search but it does not appear. Does anyone know if it is really unavailable? Has several links out of the air of that version,…
-
2
votes1
answer41
viewsA: Function simulating if in php
Move the comparisons to a loop and map with a array rules can become more readable: function determineRank($input) { // valor retornado caso $input seja maior que todos os $ranks $default =…
-
1
votes2
answers485
viewsA: Network interfaces on Docker
When installing Docker three types of network which can be consulted with the command below: > docker network ls NETWORK ID NAME DRIVER SCOPE 0a9cecbcdf3e bridge bridge local 7787cba5673e host…
-
0
votes2
answers997
viewsA: How to enable php extensions inside a Docker container
If you use the official PHP image for Docker, you can install the extensions by running the command docker-php-ext-install. If the extension has any prerequisite, it needs to be installed from your…
-
0
votes2
answers249
viewsA: What’s the difference between Http Requests and Request App
What difference in Laravel, to use use App\Http\Requests for use Request There is no class called App\Http\Requests. This is a namespace created within your application when using the command php…
-
2
votes1
answer353
viewsA: Authentication does not work after running make:auth
This error may happen if the authentication routes are not properly logged in your route file. To confirm this, run the command below and see if the authentication routes are registered: php artisan…
-
2
votes3
answers2839
viewsA: What is the solution for asynchronous PHP processes?
Well, everything goes by the approach you will take. If you expect how async and awaitC# you won’t find in PHP anyway. I won’t go into too much detail about what is asynchronous and lower-level…
-
2
votes1
answer363
viewsA: Check route with variable on Laravel 5.1
The method Request::is accepted wildcards (*) according to the documentation. The is method Allows you to Verify that the incoming request URI Matches a Given Pattern. You may use the * Character as…
-
5
votes1
answer178
viewsQ: What is the iterable type of PHP 7.1 for?
I was looking at some code to test PHP 7.1 and found the following excerpt: function doLoop(iterable $iterable) { foreach ($iterable as $value) { echo $value; } } $data = [1, 2, 3, 4];…
-
2
votes3
answers447
viewsA: How to disable the merge message in git pull?
This message only happens when you make one git pull and the remote repository received new commits. How git needs to reconcile new commits with his commit local, by default it will make a 3-way…
-
7
votes1
answer1077
viewsA: What is and how does PHP’s PHAR function work?
The class Phar is used to package PHP applications into a single file that can be easily distributed and executed. This name comes from PHP Archive and was inspired by the jar (Java Archive) already…
-
12
votes1
answer743
viewsA: What is namespace really for?
The main use of namespaces is for organization and to avoid collision of class names. PHP does not allow two classes to have the same name, and to avoid this problem we had to create very specific…
-
1
votes3
answers1085
viewsA: Calculate difference between two dates - I cannot convert the database date to Datetime
Assuming $eventos is a array with models of Eloquent, you can automatically convert attributes using a Date Mutator <?php namespace App; use Illuminate\Database\Eloquent\Model; class Eventos…
-
1
votes1
answer1593
viewsA: How do I set the url for a route in Laravel?
The idea of using a Route::resource is to standardize all routes of a given resource by following a convention that is documented here: | Verb | URI | Action | Route Name |…
-
1
votes2
answers109
viewsA: How to use sprintf to create a query with date_format()
I’m reworking a client system and the same is using the procedural mode in the login and not PDO, but to give more security, I used sprintf, but it’s not working. The use or not of the sprintf(),…
-
1
votes2
answers146
viewsA: Calling database data with $http get
The way you are using the function json_encode is strange. You don’t need to create a string formatted in json, can directly pass the array of results for him: (I am assuming that this PHP file is…
-
6
votes4
answers388
viewsA: Regex to capture infinite groups in a URL by separating them by the bar
Do you really need to be a regular expression? How about using one explode()? <?php $str = 'Controller/Action/Param1/Param2/Param3'; $segments = explode('/', $str)); print_r($segments); This…
-
1
votes3
answers829
viewsA: How can I check if a variable is in date format?
Want to work with dates in PHP? Forget it regex or explode of strings or reinvent the wheel to make calculations with dates... Spend a little time studying the Datetime and you’ll see that…
-
4
votes2
answers2451
viewsA: Change storage location in Laravel 5.4
You don’t need to change anything in your code. If you are using Linux (or the Homesteaden) just execute a command that makes a symlinken (symbolic link) between the /storage/app/public and…
-
1
votes3
answers5128
viewsA: How to allow only numbers and dashes with preg_replace?
Well, your doubt is not very clear and it seems to me to be a misconception. The preg_replace is used to replace characters matching a given regex with some other value. That is, it makes no sense…
-
3
votes2
answers188
viewsA: How to remove accent text in php?
Your logic works perfectly with accents, the problem is that you are transforming the array with elements to remove in a string. Look at the following, I just changed the statement of array for…
-
1
votes1
answer659
viewsA: Validation with Internationalization in Laravel 5.3 error
The problem is how you define your Route::group. This method is different from those used with Route::get, Route::post and the like. Although it also receives an anonymous function, the first…
-
5
votes1
answer2598
viewsA: What is a. lock file?
The archives .lock in these two cases are automatically generated by the package manager (Composer or Yarn) to ensure the exact version your code is using. In the archives .json correspondent, you…
-
3
votes1
answer337
viewsA: What is the function of the __wakeup magic method in php?
With magical method __wakeup() you can rebuild serialized objects through the method unserialize(). Object serialization is useful when you need to transport objects to be executed elsewhere (in…
-
5
votes1
answer10046
viewsA: How to use the Pattern attribute?
The attribute pattern in forms in HTML 5 allow that form to be validated through a Regular Expression. Regular expressions are a way to validate textual expressions that follow some type of pattern…
-
2
votes2
answers3113
viewsA: How to check if the entity already exists in the bank
In your case you can use the method firstOrCreate: User::firstOrCreate([ 'id'=>'1', 'name' => 'admin', 'email' => '[email protected]', 'password' => bcrypt('admin'), 'remember_token' =>…
-
2
votes0
answers901
viewsQ: Is it interesting to learn JSP in 2017?
This semester in college I will attend the course of Software Development for Web and while studying the menu I saw that we will use JSP. What struck me is the fact that the discipline comes…
-
2
votes1
answer515
viewsA: Maintenance routine for cleaning log tables (sysssislog and sysdtslog90)
These tables are used even for logs SSIS and over time tend to get big. The recommendations I read here and here are that you can delete these logs if you don’t need to. Is there any specific…
-
0
votes1
answer50
viewsA: Ioc Laravel Conflict 5.3
The problem lies in the design of your classes. It is simply impossible to instantiate any of the classes because one depends on the other. If I were to build them manually, as it would be? $chat =…
-
1
votes2
answers1361
viewsA: Display only one record with foreach
You can limit your query for a single result, thus the foreach will have only one iteration. <?php $posts = DBRead( 'posts', "WHERE categoria = 3 AND status = 1 ORDER BY data_numero ASC LIMIT 1"…