Skip to content

Call to undefined method Leaf\App::blade(), when using BareUI. #331

Description

@nicolasbui

Describe the bug

In a simple project, no MVC involved, when use only BareUI, Leaf PHP raised the exception :
Call to undefined method Leaf\App::blade(). If you're trying to use a view engine, attach it with attachView() first.

To Reproduce

When creating a "Lite Leaf app" then add "bareui":

  • create app: "leaf create my-app"
  • select "Lite Leaf app"
  • add bareui moduke: "leaf install bareui"
  • configure view path: "app()->template()->config('path', './views');"
  • create a view file: "./view/sample/index.view.php"
  • then add a route: "app()->get('/sample', function () {
    response()->render('sample/index');
    });"

Expected behavior

the content of the view should be displayed instead of an exception

Current behavior

Call to undefined method Leaf\App::blade(). If you're trying to use a view engine, attach it with attachView() first.

Work around

instead of: response()->render('sample/index');
use instead: response()->markup(app()->template()->render('sample/index'));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions