vendredi 30 octobre 2020

Laravel how can I run two redirect with each other simultaneously?

I'm trying to execute two redirect at the same time, but I don't know how to display this correctly in Laravel. Laravel 5.7 is used.

Here is my code:

    public function store(Request $request)
    {
        
         $validatedData = $request->validate([
            'name' => 'min:2|max:50',
            'details' => 'nullable|max:255',
            'image' => 'nullable',
            'tournament_id' => 'nullable',
            
        ]);
        
          $team = Team::create($validatedData);

        return redirect()
            ->route('tournaments.show', $tournament)
            ->with('success', 'Team erstellt');
        
        return redirect()
        ->route('teams.show', $team)
        ->with('success', 'Team erstellt');
        
        $errors = $validator->errors();
        
        $tournament = Tournament::where('id', $team->tournament_id)->first();


return redirect()->back()->with('error' ,'Error Foo');
    }


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire