Posts by 13dev • 2,415 points
133 posts
-
0
votes2
answers247
viewsA: Middleware in the Laravel to check if the user belongs to a group
Well doing this method would really take a lot of checks and create a middleware new whenever a new group arises, a solution to this problem would be to group the groups (mixed)... as follows: Let’s…
-
1
votes1
answer69
viewsA: Save array values in Database
By making echo of a array in php it will present you a 'friendly' format, and so your backend and frontend interconnection will not be the best... there are some structuring languages out there as…
-
0
votes1
answer101
viewsA: How to use Top Langs in Git Hub
Just create a repository with the same name as the github username, then create a file called readme.md and inside just glues this code: ![TOP…
-
1
votes1
answer14
viewsA: Error trying to create the first dependency with the Composer init command
Try to reset the Composer repository and use https protocol only... composer config -g repo.packagist composer https://packagist.org composer config -g github-protocols https ssh This will…
-
0
votes2
answers83
viewsA: PHP Lumen - TDD test Image upload does not work in PHP’s Lumen framework
I think your mistake is setting the header Content-Type: Instead: 'Content-Type' => 'multpart\formdata' Try it this way: 'Content-Type' => 'multipart/form-data'…
-
1
votes2
answers257
viewsA: Passing the token of an Angularjs controller to an Laravel API
I think the problem is that the Bearer is "glued" to token needs a space in the middle. 'Authorization ' : 'Bearer' + $scope.token, Corrected: 'Authorization' : 'Bearer ' + $scope.token,…
-
0
votes2
answers68
viewsA: Check ID with a single foreach
Yes has a solution, creates the method contains there in Survey, example: //survey public function contains($column = 'id', $value = 0) { $users = $this->users; foreach($users as $user) {…
-
0
votes1
answer29
viewsA: Create in table related to another table does not work
In the model Address the property $table takes a string, you are setting an array.. Try it this way: protected $table = 'addresses';
-
1
votes1
answer40
viewsA: I couldn’t find the error
$_POST is a global variable (array) and these are called in function form.. try like this: $ID = $_POST['ID'];
-
1
votes3
answers69
viewsA: Transform a list into several within the same
Simply iterate the list and encapsulate each of the elements in an array. example: lista = [1,2,3,4, 40] novalista = [] for x in lista: novalista.append([x]) print(novalista) novalista will contain…
-
3
votes1
answer52
viewsA: Errors when entering data into table
The syntax of your query is wrong so accuse this error. the syntax to insert: INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...); and in your query you have…
-
0
votes2
answers58
viewsA: Object Reference not set to an instance of Object
You can simply create a property in the class you want to use the class ScriptName example: public ScriptName script; and access like this: script.anteriorobj(); remembering that you have to drag…
-
0
votes1
answer228
viewsA: Installation in Laravel project gives error
Use the parameter dmemory_limit to increase your memory: sudo php -dmemory_limit=750M composer create-project --p refer-dist laravel/laravel itp or you can also increase memory swap, just run these…
-
1
votes2
answers297
viewsA: How to show user name session inside msg with toastr using Laravel PHP?
Just concatenate the value in the method parameter success toastr()->success("Você está logado " . Auth::user()->name);
-
0
votes4
answers730
viewsA: Catch the subdomain with PHP
It would be something like: echo $caminhoAbsoluto = $_SERVER['HTTP_HOST'] . "/"; If you just want the domain use the array_shift: $var = explode('.', $_SERVER['HTTP_HOST']); echo array_shift($var);…
-
0
votes1
answer533
viewsA: Slidershow Carrousel Video And Image
If there’s a way, just capture the events of video and pause the carousel example: // capturar evento 'play' $('video').on('play', function (e) { $("#carousel").carousel('pause'); }); //capturar os…
-
0
votes1
answer722
viewsA: Google Maps, doubt about overlapping radius of markers
Use these functions to convert to radians, get the distance and check for intersection: // Esta função vai converter graus para radianos Number.prototype.toRadians = function() { return this *…
-
0
votes2
answers70
viewsA: Challenge create menu with ajax() request
Why don’t you ride the html you wish already in the callback of ajax ? example (untested) $.ajax({ url: 'produto.json', type: 'get', dataType: 'json' }).done(function(response){ var data = $('ul');…
-
1
votes1
answer1294
viewsA: Error saving monetary data: A non well Formed Numeric value encountered
Try to convert the values before adding them and checks if the fields exist and are different from nulls! Recalling that decimal house separation in PHP is done by dots. For example: if valorInterno…
-
2
votes1
answer553
viewsA: Variable returns NULL - Trying to get Property of non-object
You are trying to obtain properties from a user who there is no (not logged in), to resolve you need to verify that the user is logged in example: <div class="pull-left info text-center">…
-
1
votes3
answers13726
viewsA: Error while running Composer
Realize you’re using the version 5.6 so these answers not so correct for the simple reason of installing modules for the version 7.0 of PHP Try this command: $ sudo apt-get install…
-
1
votes1
answer741
viewsA: Summernote post WYSIWYG in PHP does not take HTML
It makes sense because your form is taking the value of the textarea and not the code contained there. To get the code just access the method code(), and so you file a requisition ajax to the file…
-
1
votes1
answer25
viewsA: concatenation error when instantiating PDO
I’m guessing it’s the line break. try like this: new PDO( "mysql:host=".self::$hostname.";dbname=". self::$dbname, self::$username, self::$password, $opcoes);
-
1
votes2
answers46
viewsA: Problem with JS/PHP
In your ajax request, you have the callback sucess that does not exist, right would be success
-
3
votes2
answers68
viewsA: Static block after the first while result
just use a accountant, or when it is 2 iteration in while will do what is desired(in this case will print publicidade). And you use the continue, to jump to the next iteration. <?php $contador =…
-
0
votes2
answers963
viewsA: Hide field and change button text
Just check the style display is none, working example: example: function insereInput() { var x = document.getElementById("inputprogram"); if (x.style.display === "none") { x.style.display = "block";…
-
3
votes2
answers2040
viewsA: How to remove the position of an array with jquery
To remove a position from an array by the value just use the Index in the way splice var arr = [ "abc", "def", "ghi" ]; arr.splice(arr.indexOf("def"), 1);…
-
0
votes2
answers31
viewsA: Validate campus by calling javascript function
Missed adding the CDN vanilla-Masker.min.js, Yes it will work properly. HTML <script src="https://cdnjs.cloudflare.com/ajax/libs/vanilla-masker/1.1.0/vanilla-masker.min.js"></script>…
-
1
votes1
answer458
viewsA: Insert items into a table using Jquery
The function html of jquery reset everything inside the given element, ie delete everything and insert the code you passed by parameter. tries to use the function append, this same, adds and does…
-
0
votes1
answer171
viewsA: Query in sql for Laravel
I tried to convert this same query using mainly the function raw. of course this can be much more optimized! The result was this (haven’t tested): DB::select( DB::raw('p.nome'), DB::raw('(select…
-
0
votes1
answer169
viewsA: Change the project root directory
Tries to change the folder synchronization, using the property synced_folder as an example to follow: config.vm.synced_folder "src/", "/srv/website" Documentation…
-
1
votes1
answer740
viewsA: transform js variable into json object
Just use the function parse() example: var jsonString = "{ \"0\" : { \"margin-left\":\"-0%\"} }"; jsonString = JSON.parse(jsonString);…
-
2
votes2
answers121
viewsA: delete select options from other selects
Simplest option is to capture the 'change' event from the select, to cycle from there the siblings helping: HTML <select name="select1"> <option>default</option> <option…
-
1
votes1
answer482
viewsA: javascript or php - how to read consumer account slips
I particularly like it very much of this library, simple to use and effective: You simply have to create a tag img, svg or canvas and inform the javascript <svg id="barcode"></svg>…
-
0
votes2
answers74
viewsA: I do not know how to do that when the radio that has an img disappears, when selected (JAVASCRIPT if possible)
I advise you to use Jquery to get a solution (if well with javascript also works!) $('#mtruim').on('change', function() { var valor = $('#mtruim:checked').val(); alert($('#mtruim:checked').val());…
-
0
votes2
answers33
viewsA: Creating two links with path of a Explode
I believe the mistake is in foreach you’re not doing it right with the hyperlink? <?php if($upload == '' || $upload == 'Sem arquivo anexo') { echo 'Não existem arquivos anexos para este…
-
0
votes1
answer135
viewsA: How to identify which method called the view in Laravel 5.4?
All you have to do is use getActionName echo Route::getCurrentRoute()->getActionName();
-
2
votes1
answer245
viewsQ: PHP in production with Composer
I have an application that uses some dependencies and these same managed by the commiserate everything working in the development environment. But in production, how is it possible to install an…
-
1
votes1
answer68
viewsA: Multiple upload of troublesome images
I believe the error is in the creation of the folder and you only declare $trataEspaço if $p = 0 ,Try it this way: $countArr = count($_FILES['arquivo']['name']); for($i = 0; $i < $countArr;…
-
0
votes2
answers1238
viewsA: I can’t type in input
I’ve been looking at your website and js (site.js) you are capturing the keypress and use preventDefault then try to put preventDefault within the if (keycode == '13') $(document).on('keypress',…
-
0
votes3
answers63
viewsA: I cannot retrieve JSON in jQuery
Maybe you have to parse json: $.post("<?php echo site_url('Welcome/viacep'); ?>", {cep: cep}, function(response){ var dados = JSON.parse(response); alert(dados.uf); } , 'json' );…
-
0
votes1
answer172
viewsA: Create a command-only class
Possibly args is a string and not a array strings tries to pass this way: cmd.OnCommand(new string[] { "ArgumentoUm", "ArgumentoDois", "ArgumentoTres" } ) If you want, add params: public bool…
-
1
votes3
answers773
viewsA: Pandas does not find file
Try To Add r at the beginning of the string: import pandas as pd reclamacoes = pd.read_csv(r'C:\Users\Reinaldo\Documents\Jornalismo_de_dados\Justica\reclamacoes\2017-1sem1.csv',sep=';') The r means…
-
0
votes2
answers52
viewsA: Is there a better way to remove an element from a JS array from the functional programming point of view?
I believe this would be the ideal answer if you are looking for simplicity and functional programming, using the function grep(): var obj = [ {id: "1", name: "Ola"}, {id: "2", name: "Java"}, {id:…
javascriptanswered 13dev 2,415 -
0
votes2
answers44
viewsA: how to orient image using image intervation
You’re trying to use syntax Blade within the php, and lack > to access a property or method. <?php $img = Image::make($file->caminho . $file->nome)->orientate(); ?>…
-
2
votes4
answers47253
viewsA: How to insert a line break inside the echo shell script?
You can use in printf that works well: printf "Ola\nMundo\n"
-
1
votes3
answers247
viewsA: Error when passing Ajax parameters to function in PHP class
Then the javascript object has s erroryntax it should be like this: var data = { chave1: 'valor1', chave2: 'valor2' } To pass this object through ajax follow this small example $.ajax({ type:…
-
-1
votes1
answer146
viewsQ: PHP variables
So I was studying a code here, and I came across a variable variable. I have heard a lot about this concept but so far I still do not understand what they are for, when we should use etc.. So my…
-
1
votes3
answers1147
viewsA: What is the difference between . on('input') / . on('Paste') / . on('change')?
So the difference is simple on-input is called only when you introduce some value, and the on-paste will only be calling the necklaces a value Ctrl + v Take a look at this basic example:…
-
0
votes2
answers57
viewsA: How to efficiently prevent images in javascript?
Here’s a simple function to pre-load your images always liked this particular case is simple. All your images will be stored on array images. var images = []; function preload() { for (var i = 0; i…