debug rahdari point
This commit is contained in:
@@ -136,9 +136,7 @@ class RoadMaintenanceStationController extends Controller
|
||||
*/
|
||||
public function show(RahdariPoint $rahdariPoint): JsonResponse
|
||||
{
|
||||
return $this->successResponse(
|
||||
$rahdariPoint->load('files')
|
||||
);
|
||||
return $this->successResponse($rahdariPoint->load('files'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +144,6 @@ class RoadMaintenanceStationController extends Controller
|
||||
*/
|
||||
public function update(UpdateRequest $request, RahdariPoint $rahdariPoint): JsonResponse
|
||||
{
|
||||
|
||||
RahdariPointHistory::query()->create([
|
||||
'user_id' => $request->user()->id,
|
||||
'point_id' => $rahdariPoint->id,
|
||||
@@ -204,13 +201,12 @@ class RoadMaintenanceStationController extends Controller
|
||||
if ($request->hasFile($field)) {
|
||||
$existingFile = $rahdariPoint->files->get($index);
|
||||
|
||||
$newPath = FileFacade::save($request->$field, 'rahdari_points/overview');
|
||||
$newPath = FileFacade::save($request->field, 'rahdari_points/overview');
|
||||
|
||||
if ($existingFile) {
|
||||
FileFacade::delete($existingFile->path);
|
||||
$existingFile->update(['path' => $newPath]);
|
||||
} else {
|
||||
// dd($rahdariPoint->id);
|
||||
$rahdariPoint->files()->create(['path' => $newPath]);
|
||||
}
|
||||
}
|
||||
@@ -222,14 +218,12 @@ class RoadMaintenanceStationController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(RahdariPoint $rahdariPoint): JsonResponse
|
||||
public function destroy(RahdariPoint $rahdariPoint): JsonResponse
|
||||
{
|
||||
foreach ($rahdariPoint->files as $file) {
|
||||
FileFacade::delete($file->path);
|
||||
}
|
||||
|
||||
RahdariPointHistory::query()->where('point_id', $rahdariPoint->id)->delete();
|
||||
|
||||
$rahdariPoint->rahdariPointHistories()->delete();
|
||||
$rahdariPoint->files()->delete();
|
||||
$rahdariPoint->delete();
|
||||
|
||||
|
||||
@@ -122,8 +122,11 @@ class NotificationController extends Controller
|
||||
->get();
|
||||
}
|
||||
|
||||
$safety_and_privacy['step_one'] = isset($activity[0]) ? $activity[0]->cnt : 0;
|
||||
$safety_and_privacy['step_two'] = isset($activity[1]) ? $activity[1]->cnt : 0;
|
||||
$step_one = $activity->where('step', '=', 1)->first();
|
||||
$step_two = $activity->where('step', '=', 2)->first();
|
||||
|
||||
$safety_and_privacy['step_one'] = $step_one->cnt ?? 0;
|
||||
$safety_and_privacy['step_two'] = $step_two->cnt ?? 0;
|
||||
|
||||
return $safety_and_privacy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user