Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/izyim-api into asif/contact

# Conflicts:
#	Dockerfile
#	app/Company.php
#	app/Http/Controllers/CompanyController.php
#	app/Http/Kernel.php
#	app/User.php
#	composer.json
#	composer.lock
#	config/app.php
#	package-lock.json
#	routes/api.php
#	tests/TestCase.php
This commit is contained in:
Aqeeb Imtiaz Harun
2018-06-12 09:28:51 +08:00
102 changed files with 17157 additions and 14407 deletions
+5 -31
View File
@@ -8,59 +8,36 @@ use Illuminate\Http\Request;
class ContactController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$contact=Contact::all();
$response=[
'contact'=>$contact
];
return response()->json($contact, 200);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
// get company id from request ex:
//$request->input('company_id');
$company_id = $request->input('company_id');
// query to find company asisng to $company
$company = Company::find($company_id);
// query to find company asisng to $company
$company = Company::find($company_id);
// get user from session
//$request->user();
$user = $request->user();
$user = $request->user();
// prepare query
$contact = new Contact();
$contact->company_id = $company->id;
$contact->user_id = $user->id;
$contact->save();
// insert into database
return response()->json($contact, 201);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$contact = Contact::where("user_id", Auth::user()->id)->where('id', $id)->first();
@@ -72,10 +49,10 @@ class ContactController extends Controller
public function postApprove(Request $request, $id)
{
$contact = Contact::where('id', '=', e($id))->first();
$contact = Contact::where("user_id", Auth::user()->id)->where('id', $id)->first();
//$contact = Contact::where('id', '=', e($id))->first();
if($contact)
{
$action=$request->input('action');
if ($action==1)
{
@@ -99,9 +76,6 @@ class ContactController extends Controller
// $contact->status = 1;
// $contact->save();
//return redirect()->back()->with('info','Request has been approved ');
}
}
}