app/Api/V1/Controllers/InstitutionController.php
/**
     * Display the specified institution by institution id.
     *
     * @param  int $id
     * @return Institution|Institution[]|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|null
     */
Display the specified institution by institution id.
Display the specified institution by institution id .
public function show(Request $request, $id)
    {
        $institution = Institution::with('address')->with('parastatals')->find($id);
        if ($institution && $institution->showCode()) {
            $institution->makeVisible(['code', 'phone', 'email', 'address_id', 'created_by', 'updated_by']);
            $institution->parastatals->makeVisible(['code', 'phone', 'email', 'address_id', 'created_by', 'updated_by']);
        }
        if(($with = $request->input('with')) && $with == 'states') {
            return $this->withJson([
                'data' => $institution,
                'states' => State::with('cities')->get()
            ]);
        }
        return $institution;
    }
public function show ( Request $ request , $ id ) { $ institution = Institution :: with ( 'address' ) -> with ( 'parastatals' ) -> find ( $ id ) ; if ( $ institution && $ institution -> showCode ( ) ) { $ institution -> makeVisible ( [ 'code' , 'phone' , 'email' , 'address_id' , 'created_by' , 'updated_by' ] ) ; $ institution -> parastatals -> makeVisible ( [ 'code' , 'phone' , 'email' , 'address_id' , 'created_by' , 'updated_by' ] ) ; } if ( ( $ with = $ request -> input ( 'with' ) ) && $ with == 'states' ) { return $ this -> withJson ( [ 'data' => $ institution , 'states' => State :: with ( 'cities' ) -> get ( ) ] ) ; } return $ institution ; }
Display the specified institution by institution id.
Display the specified institution by institution id .