Marc Witteveen
Marc Witteveen

Reputation: 741

Blade template does not want to load from Laravel Package

I am loading the view in the package with

$this->loadViewsFrom(__DIR__.'../../resources/views', 'admin');

But when I request the page I get an error

InvalidArgumentException View [test] not found.

Interesting twist, when I put the complete path to the view folder in the loadViewsFrom method the template loads.

I load the blade template with the following code

public function showTest()
{
    return view('admin::test');
}

Right above the loadViewsFrom method, I call loadRoutesFrom method

$this->loadRoutesFrom(__DIR__.'../../routes/admin.php');

And this loads without any issue.

Any suggestions what could be the issue? The code of the package is very plain, load a blade template when a route is called.

Upvotes: -1

Views: 549

Answers (1)

Marc Witteveen
Marc Witteveen

Reputation: 741

The problem was solved by fixing the paths to view folder.

After verifying the exact location of my file by

dd(__DIR__);

I worked my way back to the correct path of the view folder, which was just one folder lower and not to.

Upvotes: 1

Related Questions