I want to extract id(as primary key) from following dd($cv)
and then make it equal to CV_id in order to stroe it in DB table : This is storing method that I used in controller :
public function appl(Request $request)
{
$application = new JobApplication;
$jobs = Job::find($request->job_id)->get();
$application->job_id =$request->job_id;
$user = User::find(auth()->user()->id);
$application->user_id = auth()->user()->id;
$cv = auth()->user()->cv->get('id');
dd( $cv);
$application->cv_id = auth()->user()->id;
$application->save();
}
So the question is how to extract only id from that user_id
CodePudding user response:
Just user like a normal model and get id from it.
dd( $cv->id);
dd( $cv->user_id);
etc..