public function ubahStatus($id)
 {
     $customer = CalonCustomer::findOrFail($id);
     if ($_POST['status'] == 1) {
         CalonCustomer::where('id', '=', $id)->update(['status' => '0']);
     } else {
         CalonCustomer::where('id', '=', $id)->update(['status' => '1']);
     }
 }
예제 #2
0
 public function search()
 {
     $keyword = Input::get('keyword');
     if (!$keyword) {
         return false;
     }
     $matches = ['alamat' => '%' . $keyword . '%', 'telp' => '%' . $keyword . '%'];
     $barangs = Barang::where('nama', 'LIKE', '%' . $keyword . '%')->paginate(10);
     $customers = Customer::where('nama', 'LIKE', '%' . $keyword . '%')->orWhere('alamat', 'LIKE', '%' . $keyword . '%')->orWhere('telp', 'LIKE', '%' . $keyword . '%')->paginate(10);
     $penjualans = Penjualan::where('nama', 'LIKE', '%' . $keyword . '%')->orWhere('alamat', 'LIKE', '%' . $keyword . '%')->orWhere('telp', 'LIKE', '%' . $keyword . '%')->orWhere('id', 'LIKE', '%' . $keyword . '%')->get();
     $calonCustomer = CalonCustomer::where('nama', '%' . $keyword . '%')->orWhere('alamat', 'LIKE', '%' . $keyword . '%')->orWhere('telp', 'LIKE', '%' . $keyword . '%')->get();
     return View::make('search', compact(array('keyword', 'barangs', 'customers', 'penjualans', 'calonCustomer')));
 }