public function postAdd()
 {
     $data = Request::all();
     $query = Employees::create($data);
     $query == true ? $message = 'Berhasil tambah data' : ($message = 'Gagal tambah data');
     return redirect('employees')->with('message', $message);
 }
 public function getAdd()
 {
     if (!Session::get('logged_in')) {
         return redirect('auth');
     }
     $employees = Employees::latest('id')->get();
     return view($this->folder . 'add')->with('employees', $employees);
 }
Ejemplo n.º 3
0
 public function index()
 {
     for ($i = 0; $i < 20; $i++) {
         Factory::create(App\Companies::class, 1);
         $company = Companies::all()->last();
         $randNum = rand(0, 10);
         for ($x = 0; $x < $randNum; $x++) {
             Factory::create(App\Employees::class);
             $user = Employees::all()->last();
             $company->employees->attach($user);
         }
     }
     //        factory(App\Companies::class, 50)->create()->each(function($c) {
     //            $c->employees()->addTo(factory(App\Employees::class)->make());
     //        });
 }
Ejemplo n.º 4
0
 public function index()
 {
     $employees = Employees::all();
     //return $aData;
     return view('pages.home', compact('employees'));
 }
Ejemplo n.º 5
0
 public function update($id, EmployeesRequest $request)
 {
     $employee = Employees::findOrFail($id);
     $employee->update($request->all());
     return redirect('employees');
 }