I'm trying to configure autocomplete input with all created blade views so is there option to get an array of all views? There is View::exists() to check for specific view but how to get all of them?
public function index(){
$allviews = Storage::files('');
return view('pages.dashboard', ['allviews' => $allviews]);
}
In my view I have this code
@foreach($allviews as $view)
<li>{{ $view }}</li>
@endforeach
It only shows .gitignore file
Views are stored in the resources/views directory. return view('greeting', ['name' => 'James']); }); As you can see, the first argument passed to the view helper corresponds to the name of the view file in the resources/views directory.
For example, if your view is stored at resources/views/admin/profile.blade.php , you may return it from one of your application's routes / controllers like so: return view('admin.profile', $data);
What are the views? Views contain the html code required by your application, and it is a method in Laravel that separates the controller logic and domain logic from the presentation logic. Views are located in the resources folder, and its path is resources/views.
$varbl = App::make("ControllerName")->FunctionName($params); to call a controller function from a my balde template(view page).
use File
facade to scan the directory and give content of it.
check here https://laravel.com/docs/5.3/filesystem#directories
configure your view disk in config/filesystems.php
add below snippet in disks array :
'disks' => [
// ...
'views' => [
'driver' => 'local',
'root' => base_path('resources/views'),
],
],
Storage::disk('views')->files('') //will list all directory and contents available in resources/views
Storage::disk('views')->files('auth') //will give content of resources/views/auth directory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With