Questions tagged as 'laravel'

1
answer

how to calculate age of a person with carbon in laravel?

Greetings I have the following code: $anios=\Carbon\Carbon::parse($paciente->fecha_nacimiento)->age; That basically calculates my age well, but this age is calculated with the current date.    How do I calculate the age for previou...
asked by 02.12.2018 / 04:05
1
answer

Problem plunk laravel 5.5

I tried to count an array by plunk (), by means of a foreach, but for some reason it always remains in the first element and does not tell me the rest, should I use each ()? * @return \Illuminate\Http\Response */ public functi...
asked by 14.12.2018 / 02:23
1
answer

if and elseif in Laravel

I am taking data from a BD and depending on the number that I return, it has to show one class or another. I'm doing something like that but it does not work. @if ($vivienda->etiqueta == 1) <p class="pLab">¡ {{ $vivienda->etiquet...
asked by 10.12.2018 / 21:13
2
answers

I can not execute my migrations to phpmyadmin with Laravel

I'm trying to execute the migrations and at the moment of executing the php artisan migrate command, it throws me this: (I have modified the error because now it throws me this one.)    [PDOException]     SQLSTATE [HY000] [1044] Access deni...
asked by 06.12.2018 / 02:54
1
answer

Laravel Route :: resource

There is a problem with Laravel, with Route::resource I do not know how to solve. I create the driver from artisan, like this: php artisan make:controller PersonaController --model=Persona In routes / web.php I have Route::resou...
asked by 19.11.2018 / 19:15
3
answers

Validate if only one file is selected in Laravel

I want to validate a field type file that is not required, but only if a file has been selected validate the type and size This is on my controller: if($request->hasFile('File')){ $file = $request->file('File'); $name...
asked by 23.11.2018 / 21:25
1
answer

Using Docker and Laravel I have this error with MySQL: "SQLSTATE [HY000] [2002] No such file or directory"

I have an app in laravel 5.2 that connects to my mysql local database, without problems. But, when placing the app inside a docker container, it can not connect to the database and I get this error: SQLSTATE[HY000] [2002] No such file or dir...
asked by 29.11.2018 / 20:10
2
answers

Show notice when trying to delete foreign key LARAVEL

I have two tables with one to many relationship, "Locations" and "Devices", the problem arises when trying to delete a "location" that has a "device" related, I need you to show a notice that says that the deletion was not made and not the error...
asked by 08.11.2018 / 12:42
1
answer

Create query with whereNotIn in laravel

I have two tables junta , voto and I want to obtain the meetings that do not have registered votes. I've tried it in the following ways and none shows the expected result. //TODO::forma 1 $juntasVotos = DB::table('vot...
asked by 05.11.2018 / 18:45
1
answer

multiple primary key laravel

** Hi, I'm new to laravel and I'd like to know how to define multiple primary keys in laravel, since this way I get an error. Schema :: create ('schedule', function (Blueprint $ table) { $table->string('dia'); $table->s...
asked by 06.10.2018 / 22:25