How to take the absolute path from the Side of the View?

Asked

Viewed 113 times

0

Laravel 4.2

I need to get the directory of . Full Slide after its rendering, how to do this?

I have been trying to navigate through the Application, this seems to be a bad idea, however I have not found any native method that does this.

dump(app()->__get('view')->getFinder());
  • "I’ve been trying to navigate through the Application, this seems like a bad idea", but need the path of views It’s also no wonder of idea, do not think?

  • I agree, I need actually just to facilitate the development here, creating a link to open the view in vscode from the browser, understood?

  • It makes sense then. But why do you think it would be bad to use the method that was quoted in your question?

  • Take a look at helpers1 Maybe you can find something to help.

  • @LINQ, I haven’t been able to access class view this way, but I’m working on it. I found it a bad practice because I considered that this was more common to do, so I should have a method of my own. But since you said this access is already a little strange, probably not even exist.

  • @Marceloboni, this is usually the first thing I do rsrs

  • Settled friends, thank you for your attention!

Show 2 more comments

1 answer

0


Create a Filter to make the View name available on its own.

filters.php

/**
 * Compartilha a globalmente variavel $view_name com o nome da view corrente
 */
View::composer('*', function ($view) {
    View::share('view_name', $view->getName());
});

From that, you can use $view_name in any View.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.