app/Http/Controllers/FileController.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()
    {
        $user = Auth::user();
        $data['file'] = File::where('user_id', $user->id)->first();
        $data['active_class'] = 'file';
        $data['programs'] = Program::all();
        $data['visa_types'] = VisaType::all();
        $data['education_levels'] = Education::all();
        $data['universities'] = University::all();
        $data['professions'] = Profession::all();
        $data['fields'] = Field::all();
        $data['knowledge'] = Knowledge::all();
        if($data['file']) {
            $data['programs_array'] = $this->stringToIntegerArray($data['file']->programs);
            $data['visa_array'] = $this->stringToIntegerArray($data['file']->visa_type);
            $data['education_array'] = $this->stringToIntegerArray($data['file']->education);
            $data['profession_array'] = $this->stringToIntegerArray($data['file']->profession);
            $data['knowledge_array'] = $this->stringToIntegerArray($data['file']->hear_about_us);
            return view('file.create', $data);
        }
        else {
            return view('file.create', $data);
        }
    }
public function create ( ) { $ user = Auth :: user ( ) ; $ data [ 'file' ] = File :: where ( 'user_id' , $ user -> id ) -> first ( ) ; $ data [ 'active_class' ] = 'file' ; $ data [ 'programs' ] = Program :: all ( ) ; $ data [ 'visa_types' ] = VisaType :: all ( ) ; $ data [ 'education_levels' ] = Education :: all ( ) ; $ data [ 'universities' ] = University :: all ( ) ; $ data [ 'professions' ] = Profession :: all ( ) ; $ data [ 'fields' ] = Field :: all ( ) ; $ data [ 'knowledge' ] = Knowledge :: all ( ) ; if ( $ data [ 'file' ] ) { $ data [ 'programs_array' ] = $ this -> stringToIntegerArray ( $ data [ 'file' ] -> programs ) ; $ data [ 'visa_array' ] = $ this -> stringToIntegerArray ( $ data [ 'file' ] -> visa_type ) ; $ data [ 'education_array' ] = $ this -> stringToIntegerArray ( $ data [ 'file' ] -> education ) ; $ data [ 'profession_array' ] = $ this -> stringToIntegerArray ( $ data [ 'file' ] -> profession ) ; $ data [ 'knowledge_array' ] = $ this -> stringToIntegerArray ( $ data [ 'file' ] -> hear_about_us ) ; return view ( 'file.create' , $ data ) ; } else { return view ( 'file.create' , $ data ) ; } }
Show the form for creating a new resource.
Show the form for creating a new resource .