i have an query, lets say its looks like this :
$insert = new A;
$insert->col1 = $request['X'];
try {
$insert->save();
}
i wonder how to get the id of the query result when save() return true? i need the data id on $insert query, then i insert the value to a new query can i make it like this?
$insert = new A;
$insert->postname = $request['X'];
try {
$insert->save();
$counter = new B;
$counter->post_id = $insert->id;
$counter->post_name = $insert->postname;
}
sorry about my broken english.
for you guys who doesnt understand what i talking about, here is an example : i want to insert the id from query table A ($insert) to post_id on table B ($counter)
so, run the first query then get the id of the result then insert it to second query
how to do that in laravel 5.x ?
Thank you
via Raphael