public function getAdd($id) { $record = Customer::find($id); if (count($record) < 0) { return redirect::back(); } return view(vw('theme.work.add'), compact('record'))->withTitle('İş Ekle'); }
public function getDelete($id, $recovery = '') { $record = Customer::find($id); if (count($record) <= 0) { return redirect(clink('customer')); } if ($recovery == 'recovery') { $record->status = 'publish'; } else { Work::where('customer_id', $record->id)->update(['status' => 'trash']); $record->status = 'trash'; } $record->save(); if ($record->save()) { if ($recovery == 'recovery') { Session::flash('message', ['title' => 'Tebrikler!', 'text' => 'Müşteri başarıyla geri yüklenmiştir.', 'type' => 'success']); } else { Session::flash('message', ['title' => 'Tebrikler!', 'text' => 'Müşteri başarıyla silinmiştir.', 'type' => 'success']); } return redirect()->back()->withInput(); } else { Session::flash('message', ['title' => 'Hata!', 'text' => 'Müşteri silinemedi! Lütfen tekrar deneyiniz', 'type' => 'error']); return redirect()->back()->withInput(); } }