I have 2 tables:
When i want to add a new item and user uses purple color on item i want that color to be saved as color_id = 1 on items table. Is there any way to do that?
Yes, sure you can do that. At first you can query to Colors
database so that you can get the id
of color. Then you can insert that id to Items
table. This is a general way. But as you are using Laravel 4, you can do this smartly by using Eloquent. Check out this point of laravel doc: http://laravel.com/docs/4.2/eloquent#relationships