vendredi 3 février 2017

Want to get data from database in laravel 5.3 as single values but it return with column name

I have started working with laravel 5.3. I want to get data from database but it is not fetching data as I want. For example I have jobs table whitch contain currently 2 records as following.

id job
1 Accountant
2 Sales Man

I have created model Named Job and have a jobsController with the following mathed:

public function job(){

$jobname = Job::select('job')->where('id',2)->get();
return view('name', array('jobname'=>$jobname));

}

And in view it show result like this [{"job":"Sales Man"}]. I want result as only Sales Man. can somebody tell me how to fix this problem.



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

Aucun commentaire:

Enregistrer un commentaire