i want to change the actual location of the view file that is rendered when view() is called in laravel. For eg. My view structure is this.
resources
view
frontend
home
index
But is want (using this code)
return view('frontend.index);
to actually call (emulate below code)
return view('frontend.home.index);
is there any way to accomplish this? Maybe modify the view() function so that it appends the param before processing the render.
in short
can i change the way view() finds the location of the blade file in laravel?
Another way of explaination
Whenever i call any view from frontend folder like
return view('frontend.index')
Is there a way to globally change the parameter i.e. ('frontend.index') to ('frontend.home.index');
PS. I am trying this for allowing users to choose multiple theme for the frontend. so i can directly add all integrations to a certain theme and save the theme as "black" inside the frontend folder of view. so the "black" will change according to the theme name . in the above example the name of the theme would be "home".
Update:
What i have done is that now i have made a view service provider and now calls
View::composer('frontend.*', function($view){
});
under boot method.
So now can i somehow change the view that is to be fetched before the view class actually checks whether the view file exists or not and change the view file that is to be rendered.