|
|
|
@ -51,15 +51,16 @@ class ActivityDokumenController extends Controller
|
|
|
|
|
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']); |
|
|
|
|
$result = $document->move($destinationPath['pathActivityDocument'], $name); |
|
|
|
|
} |
|
|
|
|
if(!$result || !$company) |
|
|
|
|
if(!$result || !$company) { |
|
|
|
|
return response()->json(['status'=>'failed','message'=>'Upload failed!','code'=> 500], 500); |
|
|
|
|
} |
|
|
|
|
$data = [ |
|
|
|
|
'activity_id' => (int)$activity_id, |
|
|
|
|
'file' => $name, |
|
|
|
|
'description' => $request->description |
|
|
|
|
]; |
|
|
|
|
$result = ActivityDokumen::create($data); |
|
|
|
|
if(!$result || !$company){ |
|
|
|
|
if(!$result || !$company) { |
|
|
|
|
unlink($destinationPath['pathActivityDocument'].$name); |
|
|
|
|
return response()->json(['status'=>'failed','message'=>'Upload failed!','code'=> 500], 500); |
|
|
|
|
} |
|
|
|
|