Posts by Patrick Maciel • 2,281 points
65 posts
-
1
votes1
answer571
viewsA: I am not allowed to write in a directory in Laravel 5.6
Error of permission: If you are on Linux chmod -R 755 /diretorio/do/seu/projeto chown -R $(whoami):$(whoami) /diretorio/do/seu/projeto Usually uploads are done in folders: - storage/app - public/…
-
1
votes1
answer44
viewsA: Error while listing database data
Actually, you should not use the variable $denuncia and yes the variable $result'. <?php foreach ( $result as $den ) { ?> $denuncia does not exist, unreported. But the right thing would be…
-
2
votes1
answer163
viewsA: Pull several images of the same id in the comic
You are overwriting the variable images. foreach ($imagens as $key => $value) { $imagens = $imagens->fetch()['imagem']; // <====== AQUI // Já existe a variável $imagens So this showing only…
phpanswered Patrick Maciel 2,281 -
0
votes1
answer28
viewsA: How to exchange the present database schema config.js?
My personal mistake... I did not post the original query here for company security reasons, but in the query had the following field: vagas_disponíveis Available accentuated. At the bank too. The…
-
2
votes1
answer28
viewsQ: How to exchange the present database schema config.js?
I am working on a finished application developed in Node.js/Expressjs. At the moment my problem is: 95% of the application uses schema A, but the new module I’m creating need to use schema B. How do…
-
2
votes2
answers694
viewsA: Sidebar via Controller - Laravel 5.1 + Adminlte 2
Your syntax is incorrect. The right thing would be... return view('inicio')->with('sidebar' => 'partials.sidebarAdmin'); return view('inicio')->with('sidebar' => 'partials.sidebarUser');…
-
0
votes1
answer171
viewsA: What is the most performative way to group data from a PHP array?
Solved. The main problem was a syntax error. Incorrect comparison. In some places I forgot to add the index ['customers'] in the array: foreach ($result as $r => $row) { // ERRADO - if…
-
0
votes1
answer171
viewsQ: What is the most performative way to group data from a PHP array?
I have an array that was generated by Database Query Builder of Laravel 5.1.x. array:96 [▼ 0 => {#1256 ▼ +"customer_id": 58 +"city": "Rio de Janeiro" +"program_id": 3 +"program": "PROGRAMA XPTO"…
-
1
votes0
answers89
viewsQ: Laravel 5 whereRaw returns error but the final query is executed correctly in postgres
You are returning the following error when running my query using whereRaw: SQLSTATE[42P18]: Indeterminate datatype: 7 ERROR: could not determine data type of Parameter $2. The code snippet…
-
0
votes1
answer426
viewsA: How to reconfigure APP_KEY from an Laravel 5.1 application
I do not believe that was the problem, but I must inform you the real cause and solution: At the beginning of the project I had a mutator for the attribute password. This mutator in turn was already…
-
0
votes1
answer426
viewsQ: How to reconfigure APP_KEY from an Laravel 5.1 application
Today I restored my Macbook Pro because I had some incompatibilities with the El Capitan (beta). During this process I forgot to backup the file .env of my project, so I could no longer login to the…
-
2
votes3
answers445
viewsQ: How to make the relationship of an extra field (pivot) in belongsToMany
Currently I have the following situation: 1 User can belong to several municipalities Within that relationship - municipios_usuarios - I also need to save who made this relationship, ie usuario_id…
-
2
votes2
answers2244
viewsQ: What is the right way to save images to a server?
I know the answer to this question is not exact, but I am asking because of alerts I received from a client’s hosting (media temple - DV Developer) The system I developed saves the images as…
-
4
votes2
answers641
viewsA: Doubts with relationships in Eloquent
What you should do is say that beyond the items you want the typeUser of the users, and this you do using the method with(). Item::with('usuarios.tipoUser') ->find($id); There are also…
-
1
votes1
answer1419
viewsA: Edit php email body with html
Let’s validate the errors before proceeding with the possible solution: 1 - Absolute paths (addresses/urls) $mailbody .= '<img src="/wp-content/uploads/2015/06/email.jpg" />'; The first…
-
1
votes1
answer332
viewsA: Configure Apache2 with PHP 5.6 to use Fuelphp
Your problem is certainly related to Virtualhost, which is nothing more than the person responsible for redirecting a particular address to a location other than the localhost’s root Document…
-
1
votes1
answer1120
viewsA: How the PDO::PARAM_STR parameter works in PHP+PDO
Just like the @Oeslei said, PDO::PARAM_INT (or STR), does not validate the value type. To do this in case you must use the filter_var, for example: if (filter_var($suaVariavel, FILTER_VALIDATE_INT))…
-
4
votes1
answer124
viewsA: Error while testing a session
First of all, always remember to post as many details as possible, for example: The important code snippets How your code should work and how it’s working The mistakes occurred (not something like:…
phpanswered Patrick Maciel 2,281 -
1
votes3
answers1239
viewsA: Code to display the login client data
Answering your questions separately: How I get session data? Using "pure php", do the following: $_SESSION['valor'] For example: after the customer logs in, you play the client id in the session…
-
0
votes2
answers3068
viewsA: Dynamic Combobox with jQuery + Laravel
After commenting on your question, I noticed at first glance that your mistake is in defining the relationship between State and Cities (hasMany). The function hasMany expects the following…
-
2
votes1
answer82
viewsA: "stdin is not a terminal" when I run Envoy - Laravel 4.2
I’ve found the solution, but so far I’m not buying it. This is my code. @servers([ 'mt' => '[email protected]' ]) That is the solution: @servers(['mt' => '[email protected]']) The function…
-
4
votes1
answer82
viewsQ: "stdin is not a terminal" when I run Envoy - Laravel 4.2
A month ago everything is working fine, until I went to deploy a project and... When you execute the command envoy run deploy, using the settings below... @servers([ 'mt' => '[email protected]'…
-
4
votes3
answers9425
viewsA: Eloquent with does not Inner Join?
I had to use the method join() of Eloquent. Initially I thought that the with performed joins as well, but apparently no longer. So I had to change the with for: join('users', 'users.id', '=',…
-
1
votes3
answers9425
viewsQ: Eloquent with does not Inner Join?
I remember in the old days "discovering" that in a query using Eloquent, if I used the with Laravel made a inner join. Today by chance I went to check the queries of a project and... [2014-11-20…
-
3
votes1
answer180
viewsQ: How and when to create Packages in Laravel 4?
I have been researching and thinking about a subject for days and I still don’t understand how to do/use/start: Setting Package: Books (crud) Package: Authentication module (users + profiles + login…
-
5
votes1
answer219
viewsQ: Consultation in a Relationship Many to Many in Laravel 4
Guys, I’m "stuck" on a problem concerning a customer report. I have the following relationship: Module (id, name) Associate (id, name, superior_id) Association_modulos (modulo_id, associado_id,…
-
3
votes2
answers479
viewsQ: Soft Delete and relationships in Laravel 4
I wonder if there is any way to use soft delete but check if there are relationships/data/records linked to the record that will be deleted before deleting. Of course, using only Laravel himself.…
-
2
votes3
answers1556
viewsA: Filter word in text with php
I’m not sure how you take these values because it’s not clear what the question is, but let’s say it’s like this (with the tab ","). $dados = "ID : 123123, Nome : Elvis, Endereço : Totis"; Then just…
phpanswered Patrick Maciel 2,281 -
3
votes2
answers1147
viewsA: How to Inherit Models in Laravel 4
It doesn’t work that way in Laravel. Relationships are represented as follows (in your case): class Usuario extends Eloquent { public function belongsTo() { return $this->belongsTo('Usuario'); }…
-
5
votes1
answer450
viewsQ: How should I organize my controllers using the SOLID methodology?
I am currently developing a project and noticed that my controllers are responsible for more than one activity. Thinking about it I remembered about the Hangout of the Laravel Brazil Community about…
-
1
votes2
answers298
viewsA: Error with $_GET function
I think the mistake is just this: elseif($update==update) Change to: elseif($update == "update") Something else extremely important: Do not use short tags = <? echo 'bla' ?>. Search the…
-
2
votes1
answer296
viewsA: How to make only the webroot folder visible to everyone?
webroot The briefcase webroot automatically visible to all. If you watch us .htaccess from Cakephp, you’ll see that in the end everything is redirected to. And as you must surely know, if you access…
-
1
votes2
answers286
viewsQ: What’s the convention on the location of the Laravel 4?
My question relates to the following: public function getIndex() { $users = \User::all(); return \View::make('admin.users.index') ->with('title', 'Usuários') ->with('users', $users); } In this…
-
1
votes1
answer29
viewsA: Redactor clips plugin does not insert exact html
I found the problem: the function insertHtml() used in clips, which is part of the API of the Redactor for some reason it changes my HTML. Searching in the API found the function set(), and when…
jqueryanswered Patrick Maciel 2,281 -
2
votes1
answer29
viewsQ: Redactor clips plugin does not insert exact html
I’m testing the plugin clips of the editor Writer to insert code snippets in my editor. However, when trying to insert a code snippet following some models of Twitter Bootstrap the plugin or…
jqueryasked Patrick Maciel 2,281 -
1
votes1
answer185
viewsA: Site opens in webroot folder
There are two ways to solve this: 1) Cpanel/Plesk Create a redirect of all requests with http://www for http://push.... For example. na Bluehost you do it on this page (it’s practically the same…
-
1
votes2
answers347
viewsQ: How do I set up HHVM for a manually compiled apache?
During the updates of Ubuntu 12.04, the HHVM was updated and then asked to run the installation command for the fast_cgi. However when executing I received the following error: ➜ ~ sudo…
-
4
votes3
answers1358
viewsA: You can run the same site on different domains
Yeah, there’s a way. But don’t do it. Why not use the "same site" on multiple domains? Because of indexing and other Google rules. This is because Google treats rigorously duplicate content on the…
-
6
votes5
answers1944
viewsA: PHP MVC - Adding CSS, Images etc
mod_rewrite / . htaccess Enable/install the mod_rewrite in his apache server. Configure your . htaccess Follow the model below: (I made the configuration only for css, but it is possible to…
-
3
votes1
answer233
viewsA: Store Files
Viable and more stable, is to upload it to the same server (online). Server / Online Of course, in an organized way. For example:…
-
1
votes1
answer219
viewsA: How to get the link id present in the postLink method?
Duvída Your controller is called Gallery? But you want to delete one GalleryImage? There are two options: Or your controller should be changed to Galleries Or you should create a controller…
-
2
votes1
answer1055
viewsA: Save data to the database using Form in Cakephp
Let’s go in pieces. 1 - Who is your Model? Admin? gallery_images? If it is gallery_images is completely incorrect by Cakephp standards. The right thing would be Galleryimage. 2 - You are trying to…
-
0
votes3
answers529
viewsA: 403 Forbidden when saving data from a form
Anyway, your second option with single quotes is incorrect: <span style='display: none"'> </span> Has a " passing by. The correct would be: <span style='display:…
-
0
votes1
answer59
viewsA: Pass two arrays to a view in Kohana
Thus: $this->template->cliente = $cliente; $this->template->usuario = $usuario; Or so: $this->template->content = View::factory('sua/view/aqui') ->bind('cliente', $cliente)…
-
16
votes6
answers90846
viewsA: Do I use PHP inside an HTML or an HTML inside a PHP?
Answering your first question I need to change all my files just to send some data to php and then process them and save to the database? No! Just keep your file containing the form for example, and…
-
2
votes2
answers583
viewsA: How to save Metabox checkbox with multiple values
Change your foreach: if ($category->term_id == $grupos) { echo "<input type='checkbox' name='grupos[]' value='$grupos' checked='true' />"; echo $category->cat_name; echo '<br>'; }…
-
1
votes6
answers2251
viewsA: Upload files (always in different folders)
For your need I would do the following: Create folders in default: year month day minute second (all together) client name (Slug => no special characters and minuscule) Then it would look like…
-
1
votes1
answer341
viewsA: How to import Mysql dumps into UTF-8?
The solution I found for this problem was to use option --default-character-set=utf8 in the import command, as the example below: mysql -uroot -p --default-character-set=utf8 database mysql>…
-
2
votes1
answer341
viewsQ: How to import Mysql dumps into UTF-8?
I’m trying to import a dump Mysql (in UTF-8), generated in Windows by Navicat, on a server Centos 6.5 with Mysql 5.5. The problem generated with this is... by executing the following command: mysql…
-
21
votes3
answers6810
viewsA: Difference between PATH_SEPARATOR and DIRECTORY_SEPARATOR
PATH_SEPARATOR It is a character used to separate directories into a single string, as can be seen in include_path in the file php.ini. UNIX The value is : /var/www/a:/var/www/b Windows The value is…