Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

laravel8 storing ids from controller

I want to extract id(as primary key) from following dd($cv)

enter image description here

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

    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

>Solution :

Just user like a normal model and get id from it.

     dd( $cv->id);
     dd( $cv->user_id);

etc..

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading