undefined index

Posted 2 months ago by PaulCatalin97

i`m trying to insert some data in model and i get this error

this is my form for this specific column

 <div class="dropdown-field">
                                    <select data-placeholder="Selecteaza Specializare" class="chosen" id="skills" name="skills" multiple="multiple">
                                        @foreach($skills as $skill)
                                            <option value="{{$skill->id}}" >{{strtoupper($skill->name)}}</option>
                                    <div class="box-footer">

and this is the controller

 class AdaugaJobController extends Controller

    public function __construct()

    public function index()
        $skills = SkillsEmployee::all();
        return view('adaugajob', compact('skills'));

    public function store(Request $request)
        $data = $request->validate([
            'titlu' => 'required|string|max:255',
            'descriere' => 'required|string|max:255',
            'salariu_estimativ' => 'required|string|max:255',
            'oras'=> 'required',


        $skills = $data['skills[]'];

        foreach($skills as $skill){
                'titlu' => $data['titlu'],
                'descriere' => $data['descriere'],
                'salariu_estimativ' => $data['salariu_estimativ'],
                'oras' => $data['oras'],
            return redirect()->route('adaugajob')->withSuccess('S-a incarcat cu success!');
            return redirect()->route('adaugajob')->withDanger('Nu s-a incarcat! A aparut o eroare.');

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