Posts by Emmanuel de Carvalho Garcia • 61 points
6 posts
-
0
votes1
answer198
viewsQ: Laravel Request validation exists and nullable at the same time
I created a request class and inject it into the store method of the controler. My Rules method within the class has the following key: public function rules() { return [ //... 'campo_id' =>…
-
0
votes3
answers1872
viewsA: Create a Request validation in Laravel with the Unique rule
When you are inside a Classerequest, the $this is the request itself. So you can reference something that was sent in your form using: $this->campo_do_form So inside your Classerequest do so:…
-
-3
votes4
answers1239
viewsA: Format city names and ignore words like "do", "dos", "das", "da", etc
I like to use regular expressions for this because of the simplicity that it provides. The function preg_replace() provides what we need using regular expression. function nomeProprio($input) {…
-
1
votes2
answers55
viewsA: How to get a value from an array property?
According to Laravel’s documentation( https://laravel.com/docs/5.5/database#running-queries ), o Facade DB together with the select method. Ex: $resultados = DB::select('select * from ...') It will…
-
0
votes1
answer41
viewsA: Same pop up on multiple pages
if it is PHP, you can use: include_once('nome_do_arquivo_popup.php') no template principal. if there is no main template, use the include_once('nome_do_arquivo_popup.php') in all files. That way you…
-
0
votes2
answers273
viewsA: How to insert value in BD only if it does not exist, using Laravel
Take a look here man: https://laravel.com/docs/5.5/eloquent#retrieving-single-models If what matters is email, you can use: MeuModel::firstOrCreate(['email' => '[email protected]']); using the…