Timothy
Timothy

Reputation: 4285

Laravel 4 How to delete a resource with its files and records from the project

I created a controller via the sublime text plugin. Generate resource -> Tweets But later on i wanted to get rid of it and all the files and records it had created on my project so i did the following:

  1. deleted:

    Tweetscontroller.php
    views/Tweets folder
    models/Tweets.php
    create_Tweets_table migration
    seeds/TweetsTableSeeder.php
    
  2. edited off the records in:

    route.php
    databaseseeder.php,
    
  3. run dump-autoload

But later when i run "php artisan migrate:refresh" i get the following error on my command line:

    {"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'CreateTweetsTable' not found","file":"C:\\xampp\\htdocs\\l4radiate\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Migrations\\Migrator.php","line":301}}

Please let me know how i can solve this or any easier way of getting rid of a whole resource.

Upvotes: 0

Views: 898

Answers (1)

Altrim
Altrim

Reputation: 6756

When creating migrations the name of the migration file gets saved in the migrations table in the database.

So the first time when you generated the files and run migrate the name of the migration file was saved in the table.

Afterwards when you deleted manually the files and ran migrate:refresh laravel tries to read each file that is recorded in the table, so in your case it doesn't find the migration file (CreateTweetsTable) and you get the error.

Try to delete manually the row (you should see the name of the tweets table migration) in the table and see if that fixes it for you.

Upvotes: 1

Related Questions