0

I have controller called BlogsController with method home.

I have created a simple route in route.php

<?php 

use Cake\Routing\Router;

Router::connect('/', ['controller' => 'Blogs', 'action' => 'home']);

Now in browser for localhost/cake_myapp

I am getting error

A route matching "array ( 'controller' => 'Blogs', 'action' => 'view', 0 => 1, 'plugin' => NULL, '_ext' => NULL, )" could not be found.  

Why it's going for view method ?

I have checked cake routes

enter image description here

How can I solve this problem ?

Niloy Rony
  • 602
  • 1
  • 8
  • 23

1 Answers1

0

A route matching "array ( 'controller' => 'Blogs', 'action' => 'view', 0 => 1, 'plugin' => NULL, '_ext' => NULL, )" could not be found.

As per the error somewhere you are using view action of Blogs controller but you have not defined the route for that.

To resolve this create a route for view action of Blogs Controller for e.g

Router::connect('/blogs/view', ['controller' => 'Blogs', 'action' => 'view']);

OR

Router::connect('/blogs/:action', ['controller' => 'Blogs']);
Sehdev
  • 5,486
  • 3
  • 11
  • 34