I'm using model and i want to select the data from table then only get the value. I've tried this :
Rental::create([
'id_bike' => $request->id,
'bike_brand' => Bike::where('id', $request->id)->pluck('brand'),
'bike_price' => Bike::where('id', $request->id)->pluck ('price'),
]);
but the result is like this:
["Magni temporibus non et ratione qui consequatur qui."]
[95]
I need the result to be like this:
Magni temporibus non et ratione qui consequatur qui.
95
What can I do?
with eloquent if your your relation is setup correctly you can just do this for example you have the model Person and in this model we have id, name, email, country columns so if we want to call to just name of this model right this code
$people = Person::first();
dd($people->name);
and this how you catch a specific column with eloquent relationship