lundi 3 avril 2017

ow to insert data into tables related to a single form?

Good. I would like help. I do not know how to insert data into tables related to a single form in laravel

This is my model User:

use Authenticatable, Authorizable, CanResetPassword;

/**
 * The database table used by the model.
 *
 * @var string
 */
protected $table = 'users';

/**
 * The attributes that are mass assignable.
 *
 * @var array
 */
protected $fillable = ['name', 'email'];

public function credencials()
{
    return $this->hasOne('App\Credencial');
}

And this is the credential model:

protected $table = 'credencials';

protected $fillable = ['clave'];

public function users()
{
    return $this->hasOne('App\User');
}

What I do not know is how I keep the data in the related tables. help me please



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire