icelander
4 months ago
334
5
Laravel

how to get my values from an array

Posted 4 months ago by icelander

this is my output

[{"id":13,"name":"Mr Inya","subject":"ICT","class":"SS2","qualification":"B.Sc Computer Science","image":"person_6_1589825603.jpg","email":"[email protected]","email_verified_at":null,"created_at":"2020-05-18T18:13:23.000000Z","updated_at":"2020-05-18T18:13:23.000000Z","slide":[{"id":1,"subject":"ICT","class":"SS3","teacher_id":13,"topic":"Programming Language","slide":"skoolss_1589826476.pptx","teacher":"Mr Inya","created_at":"2020-05-18T18:27:56.000000Z","updated_at":"2020-05-18T18:27:56.000000Z"}]}]

how do I get the value of the slide, that is in a pdf format, to display on my page. this is my controller

 public function selected(Request $request, $subject){
      
        $class = auth::user()->class;

        $subj =Teacher::where('subject',$subject)->where('class', $class)->with('slide')->get();
     
        
        return view('auth.pages.selected-subject')->with('topics',$subj);
    }

and my blade view file

@foreach($topics as $topic)
@foreach($topic as $top)
{{$top['id']}}
@endforeach
@endforeach

Please sign in or create an account to participate in this conversation.