jeudi 28 décembre 2017

laravel 5 save to databse and return id

laravel 5 im trying to use the eloquent save whilst returning the id of the tuple using

$var=$data->save();

Then trying to return the primary key.Now my primary key is called company_id but when i run:-

$id=$data->company_id

It throws an error saying

column 'id'doesnt exist in the company table.

why does company_id get renamed to id.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2BO1qFA
via IFTTT

Aucun commentaire:

Enregistrer un commentaire