/** * Store a newly created resource in storage. * POST /workorders * * @return Response */ public function store() { $workorders = Workorder::create(Input::all()); if ($workorders) { return ['status' => true, 'data' => $workorders]; } else { return ['status' => false]; } }
/** * Store a newly created resource in storage. * POST /workorders * * @return Response */ public function store() { if (Input::has('user_id') || Input::has('property_id')) { $workorder = Workorder::create(Input::all()); if ($workorder) { return ['status' => true, 'data' => $workorder]; } else { return ['status' => false]; } } else { return ['status' => false, 'message' => 'Atleast the user or property required']; } }
public function post_saveWo() { $inp = Input::json(); try { $spk = Workorder::create(array('kso_id' => $inp->kso_id, 'wo_number' => $inp->wo_number, 'fleet_id' => $inp->fleet_id, 'driver_id' => $inp->driver_id, 'pool_id' => $inp->pool_id, 'km' => $inp->km, 'complaint' => $inp->complaint, 'information_complaint' => $inp->information_complaint, 'status' => 1, 'user_id' => Auth::user()->id, 'inserted_date_set' => $inp->date, 'beban' => $inp->beban)); if ($spk) { $z = Fleet::find($inp->fleet_id); $z->fg_bengkel = 1; $z->save(); } return json_encode(array('id' => $spk->id)); } catch (Exception $e) { return json_encode($e); } }