laravel Maximum execution time of 60 seconds exceeded —

  database, eloquent, laravel

hello guys so I am doing a laravel project ( new to laravel ).
i am supposed to to calculation from other tables and save the results in another OUTPUT table.
I have 8 calculation in total in each line and up to 3k lines to fill.
The problem that I get the ma execution time error 60 sec even if a change it in laravel and php.ini.
each function called is just calling a select where and sum I’ve decided to divide them for better org.
My question is is there a better way to process the data and minimize to exc time if you can help .

public function calcul($week)
    {   $test = Output::where('week',$week)->Limit(1);
            return self::afficher($week);

            DB::table('article')->orderBy('material')->chunk(100, function ($stocks){
            foreach ($stocks as $stock) {
                $id = $stock->material;
                $past_need=self::PassedNeeds($id) - self::NeedsInTwoWeeks($id);
                    'material' => $id,'safe_stock'=>$safe_stock,'past_need'=>$past_need,'two_week_need'=>$two_week_need,
            return self::index();

Source: Laravel

Leave a Reply