Support the ongoing development of Laravel.io →
Input Eloquent
Last updated 2 years ago.
0
Solution

Is it correct that I created "dev_id" column in "software" table, which is a foreign key to "id" in "developers" table? Yes.

Now, for the addSoftware method, try to move as much code as you can from the controller to the model.

First of all, you need a Developer, so if it doesn't exist -> create one. Then, check if the software exists, if it doesn't -> create one. Finally, update the software' release_date.

Also, have you read about RESTful?, this is a very nice tutorial: http://www.slideshare.net/landlessness/teach-a-dog-to-rest

Check this too: http://laravel.com/docs/eloquent#inserting-related-models

Greetings.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Banandrew banandrew Joined 8 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.