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); }
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()); // }); }
public function index() { $employees = Employees::all(); //return $aData; return view('pages.home', compact('employees')); }
public function update($id, EmployeesRequest $request) { $employee = Employees::findOrFail($id); $employee->update($request->all()); return redirect('employees'); }