title: How to call function from another class Laravel
body: <p>I have payroll PayrollProcessController and PayrollHelper class in my Helpers folder.</p>
  
  <p>here's my PayrollProcessController code :</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use App\Http\Controllers\Base\MasterController;
  use App\Http\Requests;
  use App\Models\PayrollPeriod;
  use App\Helpers\PayrollHelper;
  use Illuminate\Http\Request;
  use Illuminate\View\View;
  use Yajra\Datatables\Datatables;
  
  class PayrollProcessController extends MasterController
  {
  protected $indexView = 'payroll_process.index';
  protected $detailView = 'payroll_process.detail';
  protected $routeBindModel = 'payroll_process';
  protected $redirectPageWhenFormSuccess = 'payroll_process.index'; //Route Name
  protected $title = 'Payroll Process';
  
  public function render(View $view, $route = null, $obj = null, $method = 'POST')
  {
      $payrollPeriodName = PayrollPeriod::pluck('name','id');
      $view-&gt;with(compact('payrollPeriodName'));
      return parent::render($view, $route, $obj, $method);
  }
  }
  </code></pre>
  
  <p>and here's my PayrollHelper Code :</p>
  
  <pre><code>&lt;?php
  
  namespace App\Helpers;
  
  use App\Helpers\Exceptions\ValidationException;
  use App\Helpers\GeneralHelper;
  use App\Models\Config;
  use App\Models\Driver;
  use App\Models\DriverPayable;
  use App\Models\PayrollPeriod;
  use Carbon\Carbon;
  use Exception;
  use Illuminate\Support\Facades\Log;
  
  final class PayrollHelper {
  public static function processPayroll(PayrollPeriod $payrollPeriod) 
  {
      try {
          $drivers = Driver::where('active', true)-&gt;get();
          foreach ($drivers as $driver) {
              $payable = new DriverPayable;
              $payable-&gt;payrollPeriod()-&gt;associate($payrollPeriod);
              $payable-&gt;driver()-&gt;associate($driver);
              if (!$payable-&gt;save()) {
                  throw new ValidationException($payable-&gt;errors());
              }
          }
      } catch (Exception $e) {
          Log::error($e);
          SessionHelper::setMessage('Unable to process payroll, Please contact system Administrator');
      } catch (ValidationException $e) {
          Log::info($e-&gt;errors);
          SessionHelper::setMessage($e-&gt;errors);
      }
  }
  }
  ?&gt;
  </code></pre>
  
  <p>how to  call the processPayroll function ?</p>
  
  <p>Any help will be appreciated</p>