I am trying to display the maximum value of an attribute in a table
my controller
$member = DB::table('member')
->select(DB::raw('MAX(code) as code'))
->where('status', '=', "No")->get();
return view('member.index', compact('member'));
Currently this is my view
{{ $member }}
And this is the output
[{"code":14101234}]
I wanted to display something like this
14101234
I've tried using json_decode but the result remains.
Since $member
is a array of object you are getting in view.
So you can fetch a object key by ->
operator. you can fetch code like this. since you are doing ->get()
, so it will return array of object.
@foreach($member as $m)
{{ $m->code }}
@endforeach