Support the ongoing development of →
Artisan Views

Laravel can't find a view by the name post

Btw, if you add



around your code, it will be formatted. Like below:

// this is my code
// posts
Route::get('post', function () {
    return view('post', [
        // DIR = directory
        'post' => file_get_contents(DIR . '/../resources/posts/my-first-post.html')
    ]); // direct to default welcome page

It will search for for the file post.blade.php in resources/views. That means it will search for resources/views/blade.php


Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

Neru Tokisaki Neru Tokisaki neru_x Joined 2 May 2022


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.