Posts by Diego Souza • 16,524 points
642 posts
-
1
votes2
answers12706
viewsQ: How to know if a decimal number is even or odd?
There are several questions related to this question, but always with integers. For example: <?php function evenOdd($number){ $conta = $number / 2; $resto = $number % 2; if($resto == 0.0) echo…
phpasked Diego Souza 16,524 -
0
votes1
answer78
viewsA: Problem: Divs move when clicking
See if that’s it: $('.top').on('click', function() { $parent_box = $(this).closest('.box'); $parent_box.siblings().find('.bottom').hide(); $parent_box.find('.bottom').toggle(); }); .box { display:…
-
3
votes3
answers1351
viewsA: Change String Axis Y Google Chart
See if it works that way. For better understanding you can also use Jsfiddle to simulate what happens so we can help you better. In my head it came to me for now... var options = { height: 600,…
-
3
votes1
answer52
viewsA: Is it possible to make an html element expand upwards?
It has to have a combination of position:relative with position:absolute. I left a bottom margin of 5px. Hence it is to your taste. #content { width: 200px; height: 200px; background: yellow;…
-
3
votes2
answers10962
viewsA: Laravel 5.3 Trying to get Property of non-object
It turns out that your method is not loading the data into the object. For this you need to apply the method get() at the end of the method table. As in the example below: public function…
-
0
votes2
answers674
viewsA: How to use "echo" in an Laravel view?
Use @if and @endif @section('mensagens') <div class="container"> <div class="row"> @if($errors) <div class="col-md-2"></div> <div class="col-md-8 alert alert-danger">…
-
1
votes3
answers3050
viewsA: How to change the color of the input using jquery Validate?
Usually I do this using the same classes that jQuery Validate implements in the error elements. $("#form-validate").validate({ rules: { nome: "required", telefone: "required" } }); label.error{…
-
8
votes3
answers981
viewsA: What do the two dots in a row (.) mean in a file path?
Projeto Images Logo.png CSS styles.css If you are inside the CSS folder using the file style.css and want to access an image that is in a folder at the same level of the CSS folder you do:…
-
1
votes1
answer96
viewsA: Animation with Animate css3
.img-minibox { height: auto; max-height: 200px; overflow: hidden; } ul { list-style-type: none; …
-
1
votes1
answer153
viewsA: Search Array() in variable and database
I thought of something like this: <?php $campos = [ 0 => '#celular', 1 => '#ddd', 2 => '#cpf_cnpj', 3 => '#nome_razaosocial', 4 => '#mensagem', 5 => '#cod_cliente', 6 =>…
-
2
votes2
answers3841
viewsA: How do I leave the opacity of a dark image and display the figcaption text on Hover?
.efeito { opacity: 1; position: relative; } .efeito figure .box-black { position: absolute; width: 100%; …
-
1
votes3
answers246
viewsA: I need to check if my JSON is empty to search for url with parameter set in Curl
Makes an Ternary IF when receiving the value of the field, asking if the content of the value is greater than 0. If it is not, it is 0. IF Ternary VARIÁVEL = (CONDIÇÃO) ? VERDADEIRO : FALSO Code…
-
0
votes0
answers35
viewsQ: How to Get Results Close to a Specific
I’m trying to get results close to a specific record. I tried to use the ABS, but I couldn’t do it using it. The result limit is 5. Dice MARCA NOME_MARCA MEDIA 8 TOYOTA 100 11 HONDA 100 5 FORD 100…
mysqlasked Diego Souza 16,524 -
2
votes1
answer54
viewsA: Doubt with facebook API
Yes. It is possible. There are buttons ready on Facebook. Share https://developers.facebook.com/docs/plugins/share-button?locale=pt_BR Enjoy https://developers.facebook.com/docs/plugins/like-button…
-
1
votes3
answers389
viewsA: Conflict between jquery and min-jquery
I was taking a look at your source code and I found what’s probably the problem. See in the image below: I think this might be the page you’re making. In this case see that the plugin jQuery is…
jqueryanswered Diego Souza 16,524 -
2
votes1
answer1479
viewsA: Query with random result
SQL Server If it is SQL Server, then you can use NewId() in the Order By. SELECT DISTINCT IP, USUARIO, DATA FROM PCN_ROMANEIO_ACESSO PRA WHERE pra. STATUS = 'OK' AND trunc (pra. DATA) = trunc…
-
3
votes1
answer184
viewsQ: How to Place Image on X-Axis
I’m trying to put an image on this graph that represents the Labels, but how is a canvas I don’t know how to do this in Chartjs. JS myBarChart = new Chart(chartBar, { type: 'bar', data: { labels:…
-
1
votes2
answers312
viewsQ: How to Sort Records After Count
Query SET @ranking = 0; SELECT @ranking := @ranking + 1 AS rank, `empresas`.`id`, `empresas`.`id` AS `id_empresa`, `empresas`.`id_marca`, `slug`, `slug_bairro`, `empresa_logins`.`nome`,…
mysqlasked Diego Souza 16,524 -
1
votes1
answer141
viewsQ: Is it mandatory to visit Mutator/Accessor?
I just faced a problem in Laravel 5.1. Suppose I have the following: Model class User extends Model{ # Mutator public function getNomeUpperAttribute(){ return…
-
3
votes1
answer42
viewsA: Syntax of Mysql
You have to use them by simple quotation marks and you don’t necessarily need to escape them, unless the word has in its string the character of the quotation marks. UPDATE clientes SET txtEndereco…
-
2
votes1
answer41
viewsA: Doubt with Join
SELECT street, number, city.city_id, town, link FROM address INNER JOIN city ON city.city_id = address.city_id WHERE address.id = : address …
databaseanswered Diego Souza 16,524 -
2
votes1
answer1682
viewsA: How do I upload files by sending the attachment as an email in Windows 5.3?
First, you have to put the attribute enctype="multipart/form-data" in his <form>. Thus remaining: <form action="{{ url('trabalhe-conosco') }}" method="POST" class="row"…
-
1
votes2
answers2387
viewsA: Do a custom validation on Laravel 5
In the Service Provider that does the validation you can use the $this, why it references the Controller Request. public function rules() { if($this->nome_do_campo){ } else{ } }…
-
3
votes2
answers1012
viewsA: Consultation with Eloquent do Laravel
If I’m not mistaken, when using the DB You have to make the Pagination manually. But if you want to use the Eloquent you can do so: $questoes = Questao::leftJoin('capitulos_questoes',…
-
0
votes2
answers812
viewsA: Check for repeated numbers between two php arrays
You can use the array_intersect <?php $array1 = array("a" => "verde", "vermelho", "azul"); $array2 = array("b" => "verde", "amarelo", "vermelho"); $result = array_intersect($array1,…
-
1
votes3
answers245
viewsA: Error doing Join with Laravel Query Builder
You could do it using Eloquent that way: Controller public function getStockDanger() { $data = Product::get(); return view( 'product.index', [ 'data' => $data, 'data_category' =>…
-
1
votes1
answer142
viewsQ: Is it possible to sort the result of the parent model by the child model?
Controller $menu = MenuLoginPermission::with('submenu') ->where('id_empresa_login', '=', $idUser) ->get(); Model Menuloginpermission class MenuLoginPermission extends Model { public function…
laravelasked Diego Souza 16,524 -
18
votes4
answers2317
viewsQ: What is the use of Exclamation Mark (!) before declaring functions in Javascript?
I was reading a manual, and I was asked to start the functions like this: !function (){ }(); This exclamation mark appeared. What is the purpose of it?
javascriptasked Diego Souza 16,524 -
1
votes2
answers528
viewsA: How to show the number records in PDO using COUNT( * )?
You have to make one count() in your query and recover in PHP. $Query = "SELECT COUNT(codigo) AS qtd, funcionarios.usuario, date_format(funcionarios.data,'%d/%m/%Y %H:%i:%s') as data , codigo, nome…
-
1
votes3
answers864
viewsA: css select only first level
If I understand what you want: ul li ul { display: none; } ul li ul li > ul{ display: none; } ul li:hover > ul{ display: block; } ul li:hover > ul > li:hover > ul{ display: block; }…
-
0
votes1
answer33
viewsA: Problem with date!
You can use two functions together: date() and strtotime(). $dateFoundation = $_POST['data']; $dateFoundation = date('Y-m-d', strtotime($dateFoundation)); if($informations->fundation_date !=…
phpanswered Diego Souza 16,524 -
1
votes2
answers501
viewsA: sql return zero
You have to make a RIGHT JOIN. You should have a county table. Just make the call. SELECT MUNICIPIO.ID, COALESCE (QTD(CODMUNICIPIO), 0) AS QTD FROM ARTESAO RIGHT JOIN MUNICIPIOS ON MUNICIPIOS.ID =…
mysqlanswered Diego Souza 16,524 -
3
votes3
answers259
viewsA: Javascript - Make <article> appear by clicking on a <li>
First of all, its elements <li> need to have a class. Second, you don’t need the attribute ID. Within the <li> put a <a> with a HREF pointing to the ID the <article> Assign a…
-
1
votes1
answer86
viewsA: How to send values in a hidden way to the SQL Database within Windows with POST
In the function you do the check sends a value to a type field hidden in HTML and send via POST to PHP. <input type="hidden" value="desktop" name="device"> PHP $device = $_POST['device'];…
-
3
votes1
answer96
viewsA: List errors returned in an ajax request
Use the each to browse the JSON $.ajax({ url: url, data: $('#' + id).serialize(), type: 'POST', success: function (data) { $.each(data, function(i,v){…
-
11
votes3
answers4045
viewsA: How to add <li> dynamically in <ul> with jQuery?
You probably have a <ul> on your page, set an ID for it or CLASS if you don’t. And success AJAX put the code below inside the for: $('#id-do-ul').append('<li><a…
-
1
votes4
answers539
viewsA: Pick up word in the middle of a text
You can also use the combination of split() with end(): $link = "uploads/tutorial.pdf"; $file = split ("/", $link); $fileName = end($file); echo $fileName; pdf tutorial.…
phpanswered Diego Souza 16,524 -
1
votes1
answer447
viewsA: Build Ionic app for older version of Android
Log in to the main folder of the project. Go to the file config.xml. You will find these two lines: <preference name="android-minSdkVersion" value="15"/> <preference…
-
2
votes2
answers572
viewsA: How to remove dotted under a link
Apparently this is an edge. Just do this in the CSS in the correct element: border: none;
-
1
votes4
answers676
viewsA: How to make a Select from two 1-N tables and return only one record from the second?
Use the DISTINCT to select only the first image combined with the ORDER BY. SELECT DISTINCT NOME, CAMINHO FROM PRODUTO INNER JOIN IMAGEM ON IMAGEM.ID_PRODUTO = PRODUTO.ID_PRODUTO AND…
mysqlanswered Diego Souza 16,524 -
4
votes1
answer226
viewsA: Check which Guard is logged
Man, have you thought about it: $guard = $this->getGuard(); $provider = $guard->getProvider(); Auth::guard($provider)->get()->name; Otherwise, something you can do:…
-
1
votes3
answers2985
viewsA: Delete file Laravel
You can use the File. File::delete('img/imagem.png'); Don’t forget the: use File; File may be the same as Storage.…
-
1
votes3
answers2215
viewsA: belongsToMany Laravel - find()
You can use the hasMany instead of belongsToMany. Seria belongsToMany if you did the SELECT through the table Categorypost. Model Post.php public function categorias(){ return…
-
3
votes2
answers323
viewsQ: How to sort by average and quantity (weight)?
I have this query on Mysql: SELECT dealers.id, COALESCE (AVG(rating), 0) AS media, COALESCE (COUNT(dealer_ratings.id), 0) AS qtd_avaliacoes FROM `dealers` LEFT JOIN `dealer_ratings` ON…
mysqlasked Diego Souza 16,524 -
3
votes2
answers620
viewsQ: Convert View with CSS, JS and PDF Images
I have a view on Laravel where I load multiple charts. This view is composed of HTML, Images, CSS and JS. I need to convert (export) this page to PDF via a JS or PHP function. I can’t find a library…
-
-1
votes3
answers145
viewsA: Blade default value Laravel 5.2
In Laravel 5.0 or higher is no longer used {{ }} and yes {!! !!} {!! $produto->complemento or 'Esta produto não tem complemento' !!}
-
7
votes1
answer171
viewsQ: Element Rotation With Arrow
As you see in this image, inside the dark gray ball is a number. It’s 100. That means the pointer has to hit 100. If it’s 0, it has to be in the middle of the pointer. The issue is that this value…
-
0
votes1
answer25
viewsQ: Get Only Registry Ranking Number in One Query
There’s a way I can get the ranking of a record in the table only with a Query (even if I have a Subquery) ? For example, I did it below: SELECT a.id_concessionaria, a.avscore, @rank := @rank + 1 AS…
mysqlasked Diego Souza 16,524 -
0
votes0
answers251
viewsQ: PHP-CGI Error Hosting Windows Server 2012
I asked a question earlier about installing Laravel in Windows Hosting, because of the file web config.. I managed to get the site to run. I was able to make the file and put it in the folder public…
-
4
votes1
answer674
viewsQ: Install Laravel Site on Windows Server
I’ve never had this experience of putting a website on the air using Windows Server 2012 at Locaweb. I put the site in a folder called 'new site'. And when I run the site like this: HTTP Error 500.0…