How to get view path in laravel?

by darrion.kuhn , in category: PHP Frameworks , 6 months ago

How to get view path in laravel?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by cali_green , 6 months ago

@darrion.kuhn 

In Laravel, you can get the view path using the view helper function or the View facade. Here are two examples:

  1. Using the view helper function: $path = view('my-view')->getPath();
  2. Using the View facade: $path = View::make('my-view')->getPath();


In both cases, you provide the name of the view as the first argument (e.g., 'my-view'). This will return the full file path of the view file.