0
My client class has a relationship one-to-one with endereco
and one-to-Many with contacts. How would be the functions in Cliente
to function? and in Migrate
?
0
My client class has a relationship one-to-one with endereco
and one-to-Many with contacts. How would be the functions in Cliente
to function? and in Migrate
?
0
Look at an example of One to Many and of course more examples and documentation on Laravel.com
<?php
class Category extends Eloquent {
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'categories';
/**
* Whether or not to enable timestamps.
*
* @var bool
*/
public $timestamps = false;
/**
* Defines a one-to-many relationship.
*
* @see http://laravel.com/docs/eloquent#one-to-many
*/
public function posts()
{
return $this->hasMany('Post');
}
/**
* Defines a has-many-through relationship.
*
* @see http://laravel.com/docs/eloquent#has-many-through
*/
public function comments()
{
return $this->hasManyThrough('Comment', 'Post');
}
}
Browser other questions tagged php laravel table relationship
You are not signed in. Login or sign up in order to post.