mercredi 4 mars 2020

How to send a query in a variable using laravel?

I have this function to register my users

protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => ['required', 'string', 'max:255'],
        'apellido' => ['required', 'string', 'max:255'],
        'idop' => ['required', 'string', 'max:6', 'unique:users'],
        'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
        'password' => ['required', 'string', 'min:8', 'confirmed'],
        'cedula' => ['required', 'int'],
        'fecha_nacimiento' => ['required', 'date'],
        'fecha_ingreso' => ['required', 'date'],
        'extension' => ['required', 'int'],
        'movil' => ['required', 'int'],
        'tel_hab' => ['required', 'int']
    ]);

}

I would like to send this query in a variable ($generos) to make a select

$generos = DB::table('tbl_lista_generos')
            ->select('id','genero')
            ->get();

How could I do that?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire