When trying to figure out how to do something the core does programmatically, a good place to start is the core itself. In particular, you want to look at Craft's controllers which handle all interactions with the UI and Craft's services which provide a lot of methods for common tasks. In this case, you're looking for craft\controllers\SectionsController::...


"After pushing the exec widget all the codebase changes, fields, sections are moved to the Staging environment." You skipped a step... Assuming you are properly using Project Config, you'll want to run craft up after deploying your files.


Your controller looks ok, though I would clean it up a bit and use more expressive variable names to reduce the surface area for bugs: $templateVariables = [ 'status' => true, 'message' => 'Sucess' ]; return $this->renderTemplate( 'craft-handle/test.twig', $templateVariables ); Now you will have access to the variables status and ...

Only top voted, non community-wiki answers of a minimum length are eligible