Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rushand's avatar

create method does not exist error even its on the controller

Route


Route::get('announcements/create','AnnouncementController@create');

Controller

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class AnnouncementController extends Controller
{
    public function create(){
      dd('test');
    }
}
?>

Error Msg

BadMethodCallException
Method App\Http\Controllers\AnnouncementController::create does not exist.
http://127.0.0.1:8000/announcements/create

Kindly help me to solve this issue

0 likes
9 replies
fylzero's avatar

@rushand Try running php artisan optimize:clear then see if it works. Shouldn't have to but worth a shot.

25 likes
automica's avatar

@rushand best also to check your route exists

run

php artisan route:list

and it should show in there.

1 like
rushand's avatar

Thnakyou for the rply, I tried but it didn't worked out,, Apparently it does not allow me to use 'create' method(or any other method) Under controller named AnnouncementController, I tried creating a new controller named NoticeController it it works fine

Sinnbeck's avatar

Try deleting the file and create a new one

 php artisan make:controller AnnouncementController --resource
1 like
automica's avatar

@fylzero check your controller as you may have some trailing whitespace.

you shouldn't close php tags for this reason

just ditch the following:

?>

and that may help.

1 like
GeordieJackson's avatar

Have you tried running composer dump-autoload?

That sometimes sorts these unusual glitches out.

1 like
rushand's avatar

Thankyou for the rply,, But still its the same

Please or to participate in this conversation.