Esempio n. 1
0
 public function getNextCode()
 {
     $latest = Parcels::max('code');
     $latestfromBatch = Batch::max('code');
     $thisDay = Carbon::now()->format('ymd');
     if (!$latest || $thisDay != substr($latest, 0, 6)) {
         return Carbon::now()->format('ymdH') . '001';
     }
     if ($latestfromBatch && $latestfromBatch > $latest) {
         return ++$latestfromBatch;
     }
     return ++$latest;
 }
Esempio n. 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     //		dd($request);
     $saldo = Saldo::find($id);
     $data = $saldo->getFillable();
     $willupdate = $request->only($data);
     if ($willupdate['batch_id'] == null) {
         $willupdate['batch_id'] = Batch::max('id') + 1;
     }
     Saldo::find($id)->update($willupdate);
     return redirect('saldo');
 }