S
S
shille2021-01-31 10:07:44
Laravel
shille, 2021-01-31 10:07:44

Link and page not working due to Laravel localization?

I implemented site localization, created a group for paths, gave a prefix, created middleware, in general, everything worked before I got to the page where I display cards of all tests from the database, I display a link on each card with the path {language}/test/{ test}, on all links I had a static value, most likely because of this, there are no errors on other pages. I have a path:

Route::group(['prefix' => '{language}', 'where' => ['language' => 'ru|en']], function () {

//other route

    Route::middleware(['auth:sanctum', 'verified'])
        ->resource('/test', TestController::class)
        ->name('*', 'test')

});


And here is the TestController::show() code

public function show(Test $test, TestRepository $testRepository)
    {
        $i = 0;
        $name = 0;

        $testQues = $testRepository->getTestId($test);
        $testCollect = $testRepository->getTest($test);

        return view('test.show', compact('testQues', 'testCollect', 'i', 'name'));
    }

And this is where the view issue (Card output page) comes in:
<a href="{{ route('test.show', $testsCard->id, app()->getLocale()) }}"><x-jet-button>Начать</x-jet-button></a>

In other links, I pass the value like this, and all is well:
<a href="{{ route('test.index', app()->getLocale()) }}"></a>


When I go to the page with input, I get the following error:


Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameter for [Route: test.show] [URI: {language}/test/{test}] [Missing parameter: test]. (View: C:\xampp\htdocs\jetstream\resources\views\livewire\test\card.blade.php)


I don’t even know what to do, how I didn’t try to swap, or remove app()->getLocale(), put instead of $testsCard->id - just a number, the same error, I’m writing on the site for the first time, please help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2017-07-20
@thekot24

$('."history_title:contains("купил монеты через")') // заголовки блоков, в которых есть подстрока "купил монеты через"
.each(function(){
  var block = $(this).closest('.history')
  var balance = block.find('.balance_plus').text()
  var datetime = block.find(':contains("Время")').next().text() // если они всегда так расположены
  console.log(balance, datetime)
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question