DEV Community

Cover image for [solved] Class 'App\Http\Controllers\Storage' not found - Laravel 9
dev laravel
dev laravel

Posted on

[solved] Class 'App\Http\Controllers\Storage' not found - Laravel 9

This article give on: Class ‘App\Http\Controllers\Storage’ Not Found. here laravel simple solution is here now get storage not found on this error and laravel 8 use get a*pp/http/controllers/storage solved*.

are you follow me and get this error solve laravel 6, laravel 7, laravel 8, laravel 9 get solved.

having an error:
Class ‘App\Http\Controllers\Storage’ not found
Class 'App\Http\Controllers\Storage' not found in laravel, Class 'App\Http\Controllers\Storage' not found
Solution 1: Out of Class ‘App\Http\Controllers\Storage’ not found
You need to import Storage class because it’s a facade.

Add.

use Storage;

At your Project Controller:

For example: Class ‘App\Http\Controllers\Storage’ not found

<?php

namespace App\Http\Controllers;

use Storage;

class UserController {
   ...
}
Enter fullscreen mode Exit fullscreen mode

Solution 2:
You must add this line of import use storage is use Illuminate\Support\Facades\Storage;

use Illuminate\Support\Facades\Storage;

Final Code is:

now paste this code and get this your storage is found were well.

<?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('ads.txt', 'Contents');

        return view('_MY_BLOGS');
    }
}
Enter fullscreen mode Exit fullscreen mode

I hope it can help you…

Top comments (0)