Пример #1
0
 public function run()
 {
     // TestDummy::times(20)->create('App\Post');
     Director::create(['title' => 'Fr.', 'firstname' => 'Ron', 'lastname' => 'Boudreaux', 'suffix' => 'S.J.', 'address' => 'Montserrat Retreat House', 'address2' => '600 N. Shady Shores Road', 'city' => 'Lake Dallas', 'state' => 'TX', 'zip' => '75065', 'country' => 'USA', 'homephone' => '940-321-6020 x237', 'workphone' => '940-321-6020 x237', 'mobilephone' => '940-395-7447', 'gender' => 'Male', 'languages' => 'English, Spanish', 'email' => '*****@*****.**', 'password' => bcrypt('admin')]);
     Director::create(['title' => 'Fr.', 'firstname' => 'Anthony', 'lastname' => 'Borrow', 'suffix' => 'S.J.', 'address' => 'Montserrat Retreat House', 'address2' => '600 N. Shady Shores Road', 'city' => 'Lake Dallas', 'state' => 'TX', 'zip' => '75065', 'country' => 'USA', 'homephone' => '940-321-6020 x233', 'workphone' => '940-321-6020 x233', 'mobilephone' => '504-383-5852', 'url' => 'https://arborrow.org', 'gender' => 'Male', 'languages' => 'English/Spanish', 'email' => '*****@*****.**', 'password' => bcrypt('admin')]);
     Director::create(['title' => 'Fr.', 'firstname' => 'John', 'lastname' => 'Payne', 'suffix' => 'S.J.', 'address' => 'Montserrat Retreat House', 'address2' => '600 N. Shady Shores Road', 'city' => 'Lake Dallas', 'state' => 'TX', 'zip' => '75065', 'country' => 'USA', 'homephone' => '940-321-6020 x229', 'workphone' => '940-321-6020 x229', 'mobilephone' => '512-289-3370', 'gender' => 'Male', 'languages' => 'English', 'email' => '*****@*****.**', 'password' => bcrypt('admin')]);
 }
Пример #2
0
 public function actionDelete($id)
 {
     $user = Auth::user();
     $director = Director::where('user_id', '=', $user->id)->findOrFail($id);
     $director->delete($director);
     \Session::flash('flash_message', 'You have successfully deleted a director.');
     return redirect('directors');
 }
Пример #3
0
 public function save_director(Request $request)
 {
     $k = new Kardex();
     $k->nombres = $request->nombres;
     $k->ap_paterno = $request->father;
     $k->ap_materno = $request->mother;
     $k->ci = $request->ci;
     $k->sexo = $request->sexo;
     $k->estado = 1;
     $k->save();
     $user_id = Kardex::select('id')->where('ci', '=', $request->ci)->get();
     $u = new User();
     $u->email = $request->email;
     $u->password = \Hash::make($request->ci);
     $u->tipo_usuario = 4;
     $u->id_kardex = $user_id[0]->id;
     $u->save();
     $st_id = User::select('id')->where('email', '=', $request->email)->get();
     $e = new Director();
     $e->antiguedad = $request->ant;
     $e->id_user = $st_id[0]->id;
     $e->save();
     return Redirect::back()->with(['success' => ' ']);
 }
Пример #4
0
 private function checkDirectors($directors)
 {
     $user = Auth::user();
     $currentDirectors = array_filter($directors, 'is_numeric');
     $newDirectors = array_diff($directors, $currentDirectors);
     foreach ($newDirectors as $newDirector) {
         $director = Director::create(['name' => $newDirector]);
         $user->directors()->save($director);
         $currentDirectors[] = $director->id;
     }
     return $currentDirectors;
 }
Пример #5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Director $director)
 {
     // Delete director of $id
     $director->delete();
     flash()->success('Director has been deleted!');
     return redirect('directors');
 }