/**
  * Start the calculation "in background"
  * @return \Bootstrap\Response\ButtonRemote
  */
 public function startAjax()
 {
     if (Status::isCalculationInProgress()) {
         return BootstrapUI::buttonRemoteResponse()->text('Already in progress')->disableButton()->refresh();
     }
     Log::info("{$this->getUser('username')} started calculation!");
     return BootstrapUI::buttonRemoteResponse()->disableButton()->text('Calculation has started')->after(function () {
         $calculation = new \Calculation();
         $calculation->calculate();
     });
 }
<?php

Log::info("Started calculation");
$x = new Calculation();
$x->calculate();
Log::info("Calculation done");
 public function precalculateAction()
 {
     $x = new Calculation();
     $x->calculate();
 }