vendredi 1 novembre 2019

Class App\\Http\\Controllers\\Api\\v1\\panel\\StorageController does not exist

I have a problem with running my project in Ubuntu. I wrote a project and it runs successfully in windows, but when i want to run it in Linux, i face the mentioned error. I use laravel 5.8 , react js and axios

i use this commands but does not work composer dump-autoload, php artisan config:clear

in api.php

<?php

use Illuminate\Http\Request;

 Route::prefix('v1')->namespace('Api\v1\panel')->group(function (){
    Route::get('/storage/list' , 'StorageController@list');
    Route::get('/storage/chart' , 'StorageController@chart');
    Route::post('/storage' , 'StorageController@storeNewProduct');
    Route::get('/categories' , 'CategoriesController@index');
});

in storageController

<?php

namespace App\Http\Controllers\Api\v1\Panel;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Storage;
use Illuminate\Support\Facades\DB;

class StorageController extends Controller
{

    public function list(Request $request)
    {
        dd('ssss');
        $products = Storage::get();
        return $products;
    }

in List.jsx

componentDidMount(){
        window.axios.get('/api/v1/storage/list')
        .then(response => {
            this.setState({
                storage : response.data
            })
        })
        .catch(error => {
            console.log(error);
        })
    }

While the code runs without any error in windows, when i call the controller in Linux, there appears no valid answer. in fact, a message appears that explains: the controller does not exist.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire