stop lelong

This commit is contained in:
Azfar Arsyad
2022-02-08 15:21:05 +08:00
parent 0167637e27
commit 5dd7fe1704
3 changed files with 17 additions and 3 deletions
@@ -24,7 +24,7 @@ class LelongMobileController extends Controller
$currentdate = $currentdate->toDateString();
// $arrayLelong = [];
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->get()->toArray();
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->where('sts_lelong','=',1)->get()->toArray();
foreach($lelong as $index1=>$lel)
{
+15 -1
View File
@@ -343,7 +343,7 @@ class LelongController extends Controller
$lelong = Lelong::where('id','=',$id)->first();
$lelong->masamula_lelong = $currenttime;
$lelong->masatamat_lelong = $endtime->toTimeString();
$lelong->sts_lelong = 1;
$lelong->sts_lelong = 1; //start lelong
$lelong->save();
return redirect()->route('lelong.senarailelong')
@@ -420,5 +420,19 @@ class LelongController extends Controller
->with('success','Kemaskini Berjaya');
}
public function stop($id)
{
$currentdate = Carbon::now();
$currenttime = $currentdate->toTimeString();
$lelong = Lelong::where('id','=',$id)->first();
$lelong->masatamat_lelong = $currenttime;
$lelong->sts_lelong = 2; //stop lelong
$lelong->save();
return redirect()->route('lelong.senarailelong')
->with('success','Lelongan berhenti');
}
}
@@ -44,7 +44,7 @@
@elseif ($lel->sts_lelong == 2)
<a href="{{ route('lelong.show',$lel->id) }}"><i class="fas fa-trophy"></i></a>
@else
<a class="stoplelong" href="{{ route('lelong.start',$lel->id) }}"><i class="fa fa-stop"></i></a>
<a class="stoplelong" href="{{ route('lelong.stop',$lel->id) }}"><i class="fa fa-stop"></i></a>
@endif
<a href="{{ route('lelong.show',$lel->id) }}"><i class="far fa-edit"></i></a>
@endhasrole