Browse Source

update use

pull/1/head
wahyuun 8 months ago
parent
commit
773f114404
  1. 8
      app/Http/Controllers/AssignMaterialController.php
  2. 5
      app/Http/Controllers/AssignToolsController.php
  3. 2
      app/Http/Controllers/HolidayController.php
  4. 2
      app/Http/Controllers/ReportActivityController.php
  5. 2
      app/Http/Controllers/ReportActivityMaterialController.php
  6. 2
      app/Http/Controllers/UserToActivityController.php

8
app/Http/Controllers/AssignMaterialController.php

@ -8,7 +8,7 @@ use App\Models\RequestMaterial;
use App\Models\Activity; use App\Models\Activity;
use App\Models\ReportActivityMaterial; use App\Models\ReportActivityMaterial;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Datatables; use Yajra\Datatables\Datatables;
class AssignMaterialController extends Controller class AssignMaterialController extends Controller
{ {
@ -47,7 +47,11 @@ class AssignMaterialController extends Controller
if ($planDate >= $startDate) { if ($planDate >= $startDate) {
$result = AssignMaterial::create($data); $result = AssignMaterial::create($data);
return response()->json(['status' => 'success', 'message' => 'Data added!', 'code' => 200], 200); if($result) {
return response()->json(['status' => 'success', 'message' => 'Data added!', 'code' => 200], 200);
} else {
return response()->json(['status' => 'failed', 'message' => 'Failed to add data!', 'code' => 400], 400);
}
} else { } else {
return response()->json(['status' => 'failed', 'message' => 'Failed to add data!', 'code' => 400], 400); return response()->json(['status' => 'failed', 'message' => 'Failed to add data!', 'code' => 400], 400);
} }

5
app/Http/Controllers/AssignToolsController.php

@ -2,10 +2,9 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\{AssignMaterial,AssignTools,ToolsResource};
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\AssignTools; use Yajra\Datatables\Datatables;
use Datatables;
use App\Models\ToolsResource;
class AssignToolsController extends Controller class AssignToolsController extends Controller
{ {
public function add(Request $request){ public function add(Request $request){

2
app/Http/Controllers/HolidayController.php

@ -4,7 +4,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\Holiday; use App\Models\Holiday;
use Datatables; use Yajra\Datatables\Datatables;
class HolidayController extends Controller class HolidayController extends Controller
{ {

2
app/Http/Controllers/ReportActivityController.php

@ -6,7 +6,7 @@ use Illuminate\Http\Request;
use App\Models\ReportActivity; use App\Models\ReportActivity;
use App\Models\Activity; use App\Models\Activity;
use App\Models\Image; use App\Models\Image;
use Datatables; use Yajra\Datatables\Datatables;
class ReportActivityController extends Controller class ReportActivityController extends Controller
{ {

2
app/Http/Controllers/ReportActivityMaterialController.php

@ -8,7 +8,7 @@ use Illuminate\Support\Facades\DB;
use App\Models\ReportActivityMaterial; use App\Models\ReportActivityMaterial;
use App\Models\Activity; use App\Models\Activity;
use App\Models\AssignMaterial; use App\Models\AssignMaterial;
use Datatables; use Yajra\Datatables\Datatables;
use DateTime; use DateTime;
class ReportActivityMaterialController extends Controller class ReportActivityMaterialController extends Controller

2
app/Http/Controllers/UserToActivityController.php

@ -7,7 +7,7 @@ use App\Models\UserToActivity;
use App\Models\Activity; use App\Models\Activity;
use App\Models\AssignMaterial; use App\Models\AssignMaterial;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Datatables; use Yajra\Datatables\Datatables;
class UserToActivityController extends Controller class UserToActivityController extends Controller
{ {

Loading…
Cancel
Save