Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to reload exact class after renaming the file in Laravel

I have two traits file with the same class:

app/Traits/OperationTools_OLD.php
app/Traits/OperationTools.php

The two files contain the same class name like the following:

<?php
namespace App\Traits;

use Carbon\Carbon;
use App\Http\Helpers\FoxUtils;
use App\Operation;


trait OperationTools {
    use \App\Traits\CavityTools;
   
    public function getProduction(...

The app does not recognize the code of the new file OperationTools.php and it looks to execute the code of the old one.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I have tried to change the trait name of the old file to be trait OperationTools_OLD, but now I get the error when I try to use it:

Trait ‘App\Traits\OperationTools’ not found

I think that there is what is like, a class file map, in the app that should be refreshed but I don’t know how?

I have tried artisan config:clear, view:clear but the issue is the same.

I’m using and on Ubuntu and Apache.

>Solution :

Run composer dump-autoload to create a new autoload file

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading