CakePHP 3 : Change Default Layout

To change default layout in CakePHP, We need to go in cakephp AppController.php

In AppController we have to write cakephp beforeFilter method.
beforeFilter() method is executed before every action in the controller.

It will like below example :

Location : src/Controller/AppController.php

Note : Write this method after initialize() method in AppController

public function beforeFilter(Event $event)
   $this->viewBuilder()->setLayout('admin');  //admin is our new layout name

You have to create a file in location

admin.ctp now is our default layout.