Yeah, relationships are insanity easy with Laravel. Take a look at the docs: http://laravel.com/docs/4.2/eloquent#relationships
If you keep scrolling down, after eager loading, you will learn how to query and insert data for related models.
Once set up, you can pull out related data really easy. It's one of Laravels sling points.
Hope it helps.
ok, I now can save these relationship.
But how can I set the value for $table->integer('value') which I also need in this table?
It sends on the relationship type you have set up. One to one, one to many etc?
The docs for inserting are here: http://laravel.com/docs/4.2/eloquent#inserting-related-models
You have a few different options depending on the type of relationship.
Let me know if you get stuck and I'll try to help.
Another thing maybe to look into is perhaps using repositories? That way you can make a meta object that on the frontend is simply accessing both tables but as if they were in a single table
Sounds like a good idea, but I actually solved it like this:
$user->roles()->attach(1, array('expires' => $expires));
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community