0

Hi a used every controller method as one after i created store method so i change it on Route::resource, i wanted translate routes names so i used AppService provider and add Slovakian language to routes but now i have problem and my routes are good but it doesn't work. I have every tournament page empty and slugs that are not used working with empty page too. On empty page is navbar and my blade without data from DB.

Thanks for advices.

One the my methods in controller for example

public function show(Tournament $tournament)
{

    return view('tournaments.show', [
        'tournament' => $tournament,
        'regions' => Region::where("id", "=", $tournament->region_id)->get(),
    ]);
}

My routes

Route::resource('turnaje', TournamentController::class)
->parameters([
    'tournaments' => 'tournaments:slug'
])->only([
    'create', 'store', 'edit', 'update', 'destroy'
])->middleware('auth');

Route::resource('turnaje', TournamentController::class)
    ->only([
        'index', 'show',
    ]);

AppServiceProvider

    public function boot()
{
    Route::resourceVerbs([
        'create' => 'pridat',
        'edit' => 'editovat',
    ]);
}

My blade

div class="container mx-auto">
    <h1 class="title text-center text-4xl pt-8">{{ $tournament->title }}</h1>
    <h2 class="title text-2xl">{{ $tournament->city }}</h2>
    <h3>{{ $tournament->street }}</h3>
    <p class="mt-8">{!! $tournament->text !!}</p>
</div>
Tom_hutka
  • 15
  • 4

1 Answers1

0

If you find something better, it could be like this maybe

Route::get('/turnaje', [TournamentController::class, 'index']);
Route::get('/turnaj/pridat', [TournamentController::class, 'create'])
   ->middleware('auth');
Route::get('/turnaj/{tournament}', [TournamentController::class, 'show']);

Route::resource('turnaje', TournamentController::class)->parameters([
'tournaments' => 'tournaments:slug'
])->except(['index', 'show', 'create'])->middleware('auth');