public function delete($id) { $company = Company::findOrFail($id); $company->delete(); Session::flash('info', trans('company.delete.success', array('name' => $company->name, 'restoreUrl' => URL::route('company.restore', array('id' => $company->id))))); return Redirect::route('company.index'); }
/** * Display the specified resource. * GET /orders/{id} * * @param int $id * @return Response */ public function show($company, $order) { if (is_numeric($order)) { $orders = Company::findOrFail($company)->orders->find($order); $offers = Offer::where('order_id', '=', $order)->where('provider_id', '=', Auth::user()->provider_id)->get(); $company = Company::find($company); $interval = calculate_time_interval($orders->start_date, $orders->end_date); $dates = extract_dates($orders->start_date, $interval); $offer_dates = array_pluck($offers, 'date'); } return View::make('orders.show', compact('offer_dates', 'offers', 'orders', 'company', 'interval', 'dates', 'start_at')); }
function get_company_name($id) { try { $company = Company::findOrFail($id); } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) { return '未知公司'; } return $company->name; }
public function update() { $id = Input::get('id'); $name = Input::get('name'); $description = Input::get('description', ''); $domain = Input::get('domain'); $old_logo = Input::get('old_logo'); if (sizeof(Company::where('name', $name)->where('id', '!=', $id)->get()) > 0) { Session::flash('error_msg', trans('msgs.company_already_exists')); return Redirect::to('/companies/update/')->withInput(); } if (Config::get('site-config.is_demo') && $id == 1) { Session::flash('error_msg', 'Demo : Feature is disabled'); return Redirect::to('/dashboard'); } if (!$this->companyAddValidator->validate(Input::all())) { $messages = Utils::buildMessages($this->companyAddValidator->getValidation()->messages()->all()); Session::flash('error_msg', $messages); return Redirect::to('/companies/update/' . $id)->withInput(); } else { try { $company = Company::findOrFail($id); $company->name = $name; $company->description = $description; $company->domain = $domain; $company->user_id = Auth::user()->id; $company->logo = Input::hasFile('logo') ? Utils::imageUpload(Input::file('logo'), 'companies') : $old_logo; $company->save(); Session::flash('success_msg', trans('msgs.company_updated_success')); return Redirect::to('/companies/all')->withInput(); } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) { Session::flash('error_msg', trans('msgs.unable_to_update_company')); return Redirect::to('/companies/update/' . $id)->withInput(); } } }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $company = \Input::get('company_id'); $contact = \Input::get('contact_id'); if ($company) { $updateCompany = \Company::findOrFail($company); $updateCompany->company_name = \Input::get('company_name'); $updateCompany->company_address = \Input::get('company_address'); $updateCompany->company_city = \Input::get('company_city'); $updateCompany->company_state = \Input::get('company_state'); $updateCompany->company_pin = \Input::get('company_pin'); $updateCompany->company_phone = \Input::get('company_land_line'); $updateCompany->company_alt_phone = \Input::get('company_alt_land_line'); $updateCompany->company_fax = \Input::get('company_fax'); $updateCompany->company_website = \Input::get('company_website'); if ($updateCompany->save()) { \Session::flash('success', 'Successfully updated'); return; } } if ($contact) { $uId = \Input::get('user_id'); $displayname = \Input::get('displayname'); // user display name update $user = \User::findorFail($uId); $user->displayname = $displayname; // user contact //user contact detail $updateContact = \UserContact::findOrFail($contact); $updateContact->mobile = \Input::get('mobile'); $updateContact->alt_mobile = \Input::get('alt_mobile'); $updateContact->alt_email = \Input::get('alt_email'); if ($updateContact->save() && $user->save()) { \Session::flash('success', 'Successfully updated'); return; } } }
public function postUpdateCompany() { $company = \Input::get('company'); $contact = \Input::get('contact'); $registration = \Input::get('regstration'); $professionaltax = \Input::get('professionaltax'); $provident = \Input::get('provident'); $esi_id = \Input::get('esi_id'); $incometax = \Input::get('incometax'); // condition for company if ($company) { $company_name = \Input::get('company_name'); $company_address = \Input::get('company_address'); $company_city = \Input::get('company_city'); $company_state = \Input::get('company_state'); $company_pin = \Input::get('company_pin'); $company_country = \Input::get('company_country'); $company_phone = \Input::get('company_phone'); $company_alt_phone = \Input::get('company_alt_phone'); $company_email = \Input::get('company_email'); $company_alt_email = \Input::get('company_alt_email'); $company_website = \Input::get('company_website'); // update company $updateCompany = \Company::findOrFail($company); //initailize data $updateCompany->company_name = $company_name; $updateCompany->company_address = $company_address; $updateCompany->company_city = $company_city; $updateCompany->company_state = $company_state; $updateCompany->company_pin = $company_pin; $updateCompany->company_country = $company_country; $updateCompany->company_phone = $company_phone; $updateCompany->company_alt_phone = $company_alt_phone; $updateCompany->company_email = $company_email; $updateCompany->company_alt_email = $company_alt_email; $updateCompany->company_website = $company_website; // final update if ($updateCompany->save()) { echo "Company detail Successfully updated"; return; } else { echo "Updation failed try again"; return; } } //Condition for Contact if ($contact) { $primary_contact_person = \Input::get('primary_contact_person'); $primary_phone = \Input::get('primary_phone'); $primary_alt_phone = \Input::get('primary_alt_phone'); $primary_email = \Input::get('primary_email'); $primary_alt_email = \Input::get('primary_alt_email'); $secondary_contact_person = \Input::get('secondary_contact_person'); $secondary_phone = \Input::get('secondary_phone'); $secondary_alt_phone = \Input::get('secondary_alt_phone'); $secondary_email = \Input::get('secondary_email'); $secondary_alt_email = \Input::get('secondary_alt_email'); // call contact class $updateContact = \CompanyContact::findOrFail($contact); //initalize values $updateContact->primary_contact_person = $primary_contact_person; $updateContact->primary_phone = $primary_phone; $updateContact->primary_alt_phone = $primary_alt_phone; $updateContact->primary_email = $primary_email; $updateContact->primary_alt_email = $primary_alt_email; $updateContact->secondary_contact_person = $secondary_contact_person; $updateContact->secondary_phone = $secondary_phone; $updateContact->secondary_alt_phone = $secondary_alt_phone; $updateContact->secondary_email = $secondary_email; $updateContact->secondary_alt_email = $secondary_alt_email; //update contact if ($updateContact->save()) { echo "Contact updated succssfully"; return; } else { echo "Updation failed try again"; return; } } //condition for registration if ($registration) { $reg_pan = \Input::get('reg_pan'); $reg_tan = \Input::get('reg_tan'); $reg_incorporation_date = implode('-', array_reverse(explode('/', \Input::get('reg_incorporation_date')))); $reg_tan_circle = \Input::get('reg_tan_circle'); $reg_cin = \Input::get('reg_cin'); //call registration class $updateReg = \CompanyRegistration::findOrFail($registration); $updateReg->reg_pan = $reg_pan; $updateReg->reg_tan = $reg_tan; $updateReg->reg_incorporation_date = $reg_incorporation_date; $updateReg->reg_tan_circle = $reg_tan_circle; $updateReg->reg_cin = $reg_cin; //update values if ($updateReg->save()) { echo "Registration details updated successfully"; return; } else { echo "Updation failed try again"; return; } } //condition for professional tax if ($professionaltax) { $pt = \Input::get('pt'); $pt_registration_date = implode('-', array_reverse(explode('/', \Input::get('pt_registration_date')))); $pt_signatory_name = \Input::get('pt_signatory_name'); //call pf tax class $updatePfTax = \CompanyProfessionalTax::findOrFail($professionaltax); // initialize values $updatePfTax->pt = $pt; $updatePfTax->pt_registration_date = $pt_registration_date; $updatePfTax->pt_signatory_name = $pt_signatory_name; // update values if ($updatePfTax->save()) { echo "Professional Tax updated successfully"; return; } else { echo "Updation failed try again"; return; } } // condition for provedent if ($provident) { $provident_fund = \Input::get('provident_fund'); $provident_registration_date = implode('-', array_reverse(explode('/', \Input::get('provident_registration_date')))); $provident_signatory_name = \Input::get('provident_signatory_name'); $provident_signatory_designation = \Input::get('provident_signatory_designation'); $provident_signatory_father_name = \Input::get('provident_signatory_father_name'); $provident_company_level_pf = \Input::get('provident_company_level_pf'); // call prove=ident class $updateProvident = \CompanyProvident::findOrFail($provident); $updateProvident->provident_fund = $provident_fund; $updateProvident->provident_registration_date = $provident_registration_date; $updateProvident->provident_signatory_name = $provident_signatory_name; $updateProvident->provident_signatory_designation = $provident_signatory_designation; $updateProvident->provident_signatory_father_name = $provident_signatory_father_name; $updateProvident->provident_company_level_pf = $provident_company_level_pf; //update provident if ($updateProvident->save()) { echo "Provident Fund updated successfully"; return; } else { echo "Updation failed try again"; return; } } // condition for esi info if ($esi_id) { $esi = \Input::get('esi'); $esi_registration_date = implode('-', array_reverse(explode('/', \Input::get('esi_registration_date')))); $esi_signatory_name = \Input::get('esi_signatory_name'); $esi_signatory_desgnation = \Input::get('esi_signatory_desgnation'); $esi_signatory_father_name = \Input::get('esi_signatory_father_name'); // call esi class $updateEsi = \CompanyEsi::findOrFail($esi_id); $updateEsi->esi = $esi; $updateEsi->esi_registration_date = $esi_registration_date; $updateEsi->esi_signatory_name = $esi_signatory_name; $updateEsi->esi_signatory_desgnation = $esi_signatory_desgnation; $updateEsi->esi_signatory_father_name = $esi_signatory_father_name; //update esi if ($updateEsi->save()) { echo "Esi details updated successfully"; return; } else { echo "Updation failed try again"; return; } } //condition for income tax if ($incometax) { $itax_signatory_name = \Input::get('itax_signatory_name'); $itax_signatory_desgnation = \Input::get('itax_signatory_desgnation'); $itax_signatory_father_name = \Input::get('itax_signatory_father_name'); $cit = \Input::get('cit'); $itax_address = \Input::get('itax_address'); $itax_city = \Input::get('itax_city'); $itax_pin = \Input::get('itax_pin'); //. call income tax class $updateIncometax = \CompanyIncomeTax::findOrFail($incometax); $updateIncometax->itax_signatory_name = $itax_signatory_name; $updateIncometax->itax_signatory_desgnation = $itax_signatory_desgnation; $updateIncometax->itax_signatory_father_name = $itax_signatory_father_name; $updateIncometax->cit = $cit; $updateIncometax->itax_address = $itax_address; $updateIncometax->itax_city = $itax_city; $updateIncometax->itax_pin = $itax_pin; // update Income tax if ($updateIncometax->save()) { echo "Company IncomeTax updated successfully"; return; } else { echo "Updation failed try again"; return; } } }