Laravel - Class 'App\Http\Controllers\Storage' not found
Today I explain laravel - class 'app\http\controllers\storage' not found. In this laravel download file from public storage folder example, you will learn how to download or display files from public storage folder in laravel apps. In this tutorial, you will learn laravel storage class not found.
You can solve 'Class "App\Http\Controllers\Storage" not found' issue in laravel 6, laravel 7, laravel 8 and laravel 9 version.
So let's start following Issue:
Solution:
You must need to add "use Illuminate\Support\Facades\Storage;" on top of controller, middleware, command, event or blade files. Let's see bellow:
use Illuminate\Support\Facades\Storage;
Example:
You can see controller file code, how to use it.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
Storage::put('example.txt', 'Contents');
return view('users');
}
}
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial