mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
fixed the issues that were pointed out except the pdf test
This commit is contained in:
@@ -4,7 +4,6 @@ namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Company;
|
||||
//use Image; //only used in companyProfile(), uncomment if using that portion of the code
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Validator;
|
||||
|
||||
@@ -14,7 +13,8 @@ class CompanyController extends Controller
|
||||
{
|
||||
$input = $request->all();
|
||||
Company::create($input);
|
||||
return redirect('/');
|
||||
return response()->json(['input'=>$input],201);
|
||||
//return redirect('/');
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
@@ -46,7 +46,7 @@ class CompanyController extends Controller
|
||||
$company = Company::find($id);//find the company first
|
||||
if (!$company)
|
||||
{
|
||||
return response()->json(['message'=>'Document not found'],200);
|
||||
return response()->json(['message'=>'company for company_prof not found'],200);
|
||||
}
|
||||
//validaating file types
|
||||
$validator = Validator::make($request->all(), [
|
||||
@@ -54,7 +54,7 @@ class CompanyController extends Controller
|
||||
]);
|
||||
if($validator->fails())
|
||||
{
|
||||
return "failed";
|
||||
return response()->json(['message'=>'Incorrect format'],200);
|
||||
}
|
||||
|
||||
if($file = $request->file('company_profile')) //company profile picture
|
||||
@@ -70,16 +70,6 @@ class CompanyController extends Controller
|
||||
'company_profile',/*folder name*/ $file, $unique_name. '.' .$ext
|
||||
);
|
||||
$company->company_profile = $unique_name. '.' .$ext; //update database
|
||||
// only use the following section of the code if you're omiting the upper portion, also uncomment the Image Library on line 7 & install Intervention Image package
|
||||
/*
|
||||
$name = $file->getClientOriginalName();
|
||||
$img_file = $request->file('company_profile');
|
||||
Image::make($img_file)->resize(300,300)->save(public_path('\company_profile'));
|
||||
//return $img_file;
|
||||
// $file->move('uploads/company_profile/', $img_file);
|
||||
|
||||
$input['company_profile'] = $name;
|
||||
*/
|
||||
} //end if
|
||||
$company->save();
|
||||
return response()->json(['company'=>$company],200);
|
||||
@@ -90,7 +80,7 @@ class CompanyController extends Controller
|
||||
$company = Company::find($id); //find the company first
|
||||
if (!$company)
|
||||
{
|
||||
return response()->json(['message'=>'Document not found'],200);
|
||||
return response()->json(['message'=>'company for reg_cert not found'],200);
|
||||
}
|
||||
|
||||
//validating file types
|
||||
@@ -98,7 +88,7 @@ class CompanyController extends Controller
|
||||
'reg_cert' => 'mimes:jpg,jpeg,bmp,png,gif,svg,pdf'
|
||||
]);
|
||||
if($validator->fails()){
|
||||
return "failed";
|
||||
return response()->json(['message'=>'Incorrect format'],200);
|
||||
}
|
||||
|
||||
if($request->hasFile('reg_cert')) //Registration Certificate upload
|
||||
|
||||
Reference in New Issue
Block a user