/**
  * Update the specified branch in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $branch = Branch::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Branch::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $branch->update($data);
     return Redirect::route('branches.index');
 }
 /**
  * Show the form for creating a new resource.
  * @param Request $request
  * @return Response
  */
 public function postDesv(Request $request)
 {
     $ids = $request->get('people');
     if ($ids != null) {
         $branch = Branch::findOrFail($request->get('branch'));
         $branch->people()->detach($ids);
         for ($i = 0; $i < count($ids); $i++) {
             $user = People::find($ids[$i])->user;
             $user->roles()->detach();
         }
         flash()->success('Se han desviculado (' . count($ids) . ') personas de la sucursal ' . $branch->name);
     } else {
         $branch = Branch::findOrFail($request->get('branch'));
         flash()->overlay('No se encontraron personas para desvincular de la sucursal ' . $branch->name . '.', 'Notificacion de errores');
     }
     return view('admin.showpeople', compact('branch'));
 }
Пример #3
0
 /**
  * Update the specified journal in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $journal = Journal::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Journal::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $branch = Branch::findOrFail(Input::get('branch_id'));
     $account = Account::findOrFail(Input::get('account_id'));
     $journal->branch()->associate($branch);
     $journal->account()->associate($account);
     $journal->date = Input::get('date');
     $journal->trans_no = Input::get('trans_no');
     $journal->initiated_by = Input::get('initiated_by');
     $journal->amount = Input::get('amount');
     $journal->type = Input::get('type');
     $journal->description = Input::get('description');
     $journal->update();
     return Redirect::route('journals.index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $branch = \Input::get('branch_id');
     $contact = \Input::get('contact_id');
     if ($branch) {
         $updateBranch = \Branch::findOrFail($branch);
         $updateBranch->branch_name = \Input::get('branch_name');
         $updateBranch->branch_code = \Input::get('branch_code');
         $updateBranch->branch_address = \Input::get('branch_address');
         $updateBranch->branch_city = \Input::get('branch_city');
         $updateBranch->branch_state = \Input::get('branch_state');
         $updateBranch->branch_pin = \Input::get('branch_pin');
         $updateBranch->branch_land_line = \Input::get('branch_land_line');
         $updateBranch->branch_alt_land_line = \Input::get('branch_alt_land_line');
         $updateBranch->branch_fax = \Input::get('branch_fax');
         if ($updateBranch->save()) {
             echo "Branch information successfully updated";
             return;
         } else {
             echo "Failed to update";
             return;
         }
     }
     if ($contact) {
         $updateContact = \BranchContact::findOrFail($contact);
         $updateContact->branch_head = \Input::get('branch_head');
         $updateContact->p_mobile_no = \Input::get('p_mobile_no');
         $updateContact->p_alt_mobile_no = \Input::get('p_alt_mobile_no');
         $updateContact->p_email = \Input::get('p_email');
         $updateContact->p_alt_email = \Input::get('p_alt_email');
         $updateContact->s_contact_person = \Input::get('s_contact_person');
         $updateContact->s_mobile_no = \Input::get('s_mobile_no');
         $updateContact->s_alt_mobile_no = \Input::get('s_alt_mobile_no');
         $updateContact->s_email = \Input::get('s_email');
         $updateContact->s_alt_email = \Input::get('s_alt_email');
         if ($updateContact->save()) {
             echo " Contact Successfully updated";
             return;
         } else {
             echo "Failed to update";
             return;
         }
     }
 }
Пример #5
0
 /**
  * Update the specified member in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $member = Member::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Member::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if (Input::get('branch_id') != null) {
         $branch = Branch::findOrFail(Input::get('branch_id'));
         $member->branch()->associate($branch);
     }
     if (Input::get('group_id') != null) {
         $group = Group::findOrFail(Input::get('group_id'));
         $member->group()->associate($group);
     }
     //$member->photo = Input::get('photo');
     //$member->signature = Input::get('signature');
     if (Input::hasFile('photo')) {
         $destination = public_path() . '/uploads/photos';
         $filename = str_random(12);
         $ext = Input::file('photo')->getClientOriginalExtension();
         $photo = $filename . '.' . $ext;
         Input::file('photo')->move($destination, $photo);
         $member->photo = $photo;
     }
     if (Input::hasFile('signature')) {
         $destination = public_path() . '/uploads/photos';
         $filename = str_random(12);
         $ext = Input::file('signature')->getClientOriginalExtension();
         $photo = $filename . '.' . $ext;
         Input::file('signature')->move($destination, $photo);
         $member->signature = $photo;
     }
     $member->name = Input::get('name');
     $member->id_number = Input::get('id_number');
     $member->membership_no = Input::get('membership_no');
     $member->phone = Input::get('phone');
     $member->email = Input::get('email');
     $member->address = Input::get('address');
     $member->monthly_remittance_amount = Input::get('monthly_remittance_amount');
     $member->gender = Input::get('gender');
     $member->update();
     return Redirect::route('members.index');
 }