app/Http/Controllers/RequirementController.php
/**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
Show the form for creating a new resource.
@return \Illuminate\Http\Response
Show the form for creating a new resource . @return \ Illuminate \ Http \ Response
public function create()
    {
        $subjects = Subject::all();
        $subjectArray = array();
        $subjectArray[''] = '';
        foreach ($subjects as $a_sub) {
            $subjectArray[$a_sub->id] = $a_sub->subject;
        }
        $priorities = [];
        foreach ($subjects as $a_sub) {
            $p = [];
            foreach ($a_sub->priorities as $a_priority) {
                array_push($p, $a_priority->id);
            }
            $priorities[$a_sub->id] = $p;
        }
        return view('requirements.create', [
            'subjects'      => $subjectArray,
            'priorities'    => $priorities
            ]);
    }
public function create ( ) { $ subjects = Subject :: all ( ) ; $ subjectArray = array ( ) ; $ subjectArray [ '' ] = '' ; foreach ( $ subjects as $ a_sub ) { $ subjectArray [ $ a_sub -> id ] = $ a_sub -> subject ; } $ priorities = [ ] ; foreach ( $ subjects as $ a_sub ) { $ p = [ ] ; foreach ( $ a_sub -> priorities as $ a_priority ) { array_push ( $ p , $ a_priority -> id ) ; } $ priorities [ $ a_sub -> id ] = $ p ; } return view ( 'requirements.create' , [ 'subjects' => $ subjectArray , 'priorities' => $ priorities ] ) ; }
Show the form for creating a new resource.
Show the form for creating a new resource .