in development, clear all your caches, and DONT run optimize
what is not working and how do you know?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello, I'm building simple blog, and now larave isn't able to find just one view blade, which works one hour ago. I didn't make any changes. I did try to clear caches, routes caches, view cachces, I did php artisan optimize but it still throws 404 not found error on this view.
This is view
<?php
use App\Models\PostCategory;
use App\Models\Post;
use App\Models\User;
use Illuminate\Support\Collection;
use Livewire\Attributes\Rule;
use Livewire\Volt\Component;
use Mary\Traits\Toast;
new class extends Component {
use Toast;
public $post;
public string $title;
public string $body;
public string $post_category_id;
public function postCategories(): Collection
{
return PostCategory::all();
}
public function save()
{
$validatedData = $this->validate(
[
'title' => 'required|string|min:5|max:50',
'body' => 'required|string|min:20|max:3000',
'post_category_id' => 'required',
],
[
'title.required' => 'Nadpis nesmí být prázdný.',
'title.min' => 'Nadpis musí mít minimálně 5 znaků.',
'title.max' => 'Nadpis může mít maximálně 50 znaků',
'body.required' => 'Obsah příspěvku nemůže být prázdný.',
'body.min' => 'Příspěvek musí obsahovat alespoň 20 znaků.',
'body.max' => 'Příspěvek může obsahovat maximálně 3000 znaků.',
'post_category_id.required' => 'Je nutné vybrat kategorii.',
],
);
$post = (new Post())->fill($validatedData);
$post->user_id = auth()->user()->id;
$post->save();
$this->success('Post created.', redirectTo: "/posts/{$post->id}");
}
public function with(): array
{
return [
'categories' => $this->postCategories(),
];
}
};
?>
<div>
<x-header title="Nový příspěvek" separator />
<div class="grid lg:grid-cols-4 gap-10">
<x-form wire:submit="save" class="col-span-3">
<x-input label="Nadpis" wire:model="title" />
<x-select label="Kategorie" wire:model="post_category_id" placeholder="Vyber kategorii" :options="$categories" />
<x-textarea label="Obsah" wire:model="body" rows="5" @keydown.meta.enter="$wire.save()" />
<x-slot:actions>
<x-button label="Zrušit" link="/" />
<x-button label="Vytvořit" type="submit" icon="o-paper-airplane" class="btn-primary" spinner="save" />
</x-slot:actions>
</x-form>
<div class="col-span-1">
<img src="/create-post.png" width="400" />
</div>
</div>
</div>
This is route
Volt::route('/posts/create', 'posts.create');
and this is link in layout for the create post view
<x-button label="Nový příspěvek" link="/posts/create" icon="o-plus" class="btn-primary btn-block" />
I'm lost, and I really don't understadn where can be the problem..
@jakubjv Then share your routes file, it is most likely that you have the wrong order of the routes,
You need to place all wildcard routes last in the group.
This will not work
Route::get('/books/{book}', ['BooksController' 'show']);
Route::get('/books/create)',['BooksController', 'create']);
This will
Route::get('/books/create)',['BooksController', 'create']);
Route::get('/books/{book}', ['BooksController' 'show']);
Please or to participate in this conversation.