Route::get('marquee', function(){
echo File::get('\storage\app\marquee.json');
});
I have a json file place inside storage/app
My question is how can I read this content from controller or route?
If you have file object from request then you can simply get by laravel function. $extension = $request->file->extension(); dd($extension); If you have file object from request then you can simply get by laravel function.
You can use the storage_path(); function to get storage folder path.
Using Storage
facade:
Storage::disk('local')->get('marquee.json');
The old way, using File
facade (deprecated for Laravel 7):
File::get(storage_path('app/marquee.json'));
Try this code
File::get(storage_path('app\marquee.json'));
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