Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rhand's avatar
Level 6

Laravel Jetstream Inertia Ziggy error: route 'articles' is not in the route list.

I have a issues testing Laravel Jetstream Inertia with a resource route. Not sure anymore if my route to just add basic CRUD for articles is correct. Currently getting this error with the resource route:

Ziggy error: route 'articles' is not in the route list.

I am trying to use this route for dashboard and backend articles:

Route::middleware(['auth:sanctum', 'verified'])->group(function () {
    Route::get('/dashboard', function () {
        return Inertia::render('Dashboard');
    })->name('dashboard');

    Route::resource('articles', ArticleController::class)->except('show');
});

I created a resource controller:

<?php

namespace App\Http\Controllers\Dashboard;

use App\Http\Controllers\Controller;
use App\Models\Article;
use Illuminate\Support\Facades\Request;
use Inertia\Inertia;

class ArticleController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        return Inertia::render('Article/Index', [
            "articles" => Article::orderBy('id', 'DESC')->paginate(10)
        ]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return Inertia::render('Article/Create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $request->validate([
            'title' => 'required|string',
            'body' => 'required|string',
        ]);

        $request->user()->posts()->create($request->only('title', 'body'));

        return redirect()->route('articles.index')->with('success', 'Article has been created');
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Models\Article  $article
     * @return \Illuminate\Http\Response
     */
    public function edit(Article $article)
    {
        return Inertia::render('Article/Edit', compact('article'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Article  $article
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Article $article)
    {
        $request->validate([
            'title' => 'required|string',
            'content' => 'required|string',
        ]);

        $article->update($request->only('title', 'body'));

        return back()->with('success', 'Article has been updated');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\Models\Article  $article
     * @return \Illuminate\Http\Response
     */
    public function destroy(Article $article)
    {
        $article->delete();

        return back()->with('success', 'Article has been removed');
    }
}

thinking I can manage all data. But Ziggy complains that the route articles does not exist. When I check current article routes I see

 console.log(Ziggy.routes);
09:44:52.521
Object { "ignition.healthCheck": {…}, "ignition.executeSolution": {…}, "ignition.shareReport": {…}, "ignition.scripts": {…}, "ignition.styles": {…}, login: {…}, logout: {…}, "password.request": {…}, "password.reset": {…}, "password.email": {…}, … }
​
"articles.create": Object { uri: "articles/create", methods: (2) […] }
"articles.destroy": Object { uri: "articles/{article}", methods: (1) […], bindings: {…} }
"articles.edit": Object { uri: "articles/{article}/edit", methods: (2) […], bindings: {…} }
"articles.index": Object { uri: "articles", methods: (2) […] }
"articles.store": Object { uri: "articles", methods: (1) […] }
"articles.update": Object { uri: "articles/{article}", methods: (2) […], bindings: {…} }

so I I tried other stuff.. like ... Route::resource('articles.index'...., but that did not help. How do I make a resource route a named route or route that works with Jetstream Inertia / Ziggy?

0 likes
1 reply
rhand's avatar
rhand
OP
Best Answer
Level 6

Never mind. I needed to update resources/js/Layouts/AppLayout.vue with the proper routes there, not in web.php itself.

With these jet links all was fine again:

.....
    <jet-dropdown-link :href="route('articles.index')">
        Articles Overview
    </jet-dropdown-link>

    <jet-dropdown-link :href="route('articles.create')">
        Add Article
    </jet-dropdown-link>
</template>
3 likes

Please or to participate in this conversation.