mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 12:34:06 +00:00
109 lines
2.6 KiB
PHP
109 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Deliveryinfo;
|
|
|
|
|
|
class DeliveryinfoController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
$com_id = Deliveryinfo::all();
|
|
return view('company.deliveryinfo.index');
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function create()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
$deliveryinfo = Deliveryinfo::create($request->all());
|
|
|
|
return response()->json($deliveryinfo, 201);
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function show($id)
|
|
{
|
|
$com_id = deliveryinfo::find($com_id);
|
|
return response()->json($com_id, 200);
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function edit($id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function update(Request $request, $com_id)
|
|
{
|
|
$com_id = Deliveryinfo::find($com_id);
|
|
|
|
$com_id->id = $request->input('id');
|
|
$com_id->branch = $request->input('branch');
|
|
$com_id->deli_info = $request->input('deli_info');
|
|
$com_id->address = $request->input('address');
|
|
$com_id->city = $request->input('city');
|
|
$com_id->postcode = $request->input('postcode');
|
|
$com_id->state = $request->input('state');
|
|
$com_id->country = $request->input('country');
|
|
$com_id->contact_person = $request->input('contact_person');
|
|
$com_id->contact_person_no = $request->input('contact_person_no');
|
|
$com_id->save();
|
|
|
|
return response()->json(['com_id'=>$com_id],200);
|
|
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function destroy(Deliveryinfo $com_id)
|
|
{
|
|
|
|
$com_id->delete($com_id);
|
|
|
|
return response()->json($com_id, 204);
|
|
}
|
|
}
|