public function index()
 {
     $model_business = model_business::where(array('business_status' => '1'))->get();
     $model_business_parent = model_business::where('business_status', '1')->orderBy('business_name')->pluck('business_name', 'business_id')->toArray();
     $model_bfield = model_business_field::where('bfield_status', '1')->orderBy('bfield_name')->pluck('bfield_name', 'bfield_id')->toArray();
     $model_building = model_building::where('building_status', '1')->orderBy('building_name')->pluck('building_name', 'building_id')->toArray();
     $model_business_parent = ['0' => 'No Parent'] + $model_business_parent;
     return view('backend.business.index')->with(['model_business' => $model_business, 'model_business_parent' => $model_business_parent, 'model_bfield' => $model_bfield, 'model_building' => $model_building]);
 }
Exemplo n.º 2
0
 public function editbfield()
 {
     $err = array();
     if ($_POST['_type'] == 3) {
         $model_bfield = model_business_field::find($_POST['bfield_id']);
         $model_bfield['bfield_status'] = 0;
         $model_bfield->save();
     } else {
         if ($_POST['_type'] == 1) {
             $model_bfield = new model_business_field();
             $model_bfield->create($_POST);
         } else {
             if ($_POST['_type'] == 2) {
                 $model_bfield = model_business_field::find($_POST['bfield_id']);
                 $model_bfield->fill($_POST);
                 $model_bfield->save();
             }
         }
     }
     return redirect('/backend/bfield')->withErrors($err);
 }
 public function parentName()
 {
     $model_business_field = model_business_field::find($this->bfield_parent);
     return $model_business_field['bfield_name'];
 }
 public function addNewBfield()
 {
     $model_bfield = new model_business_field();
     $model_bfield->fill($_POST);
     $model_bfield->save();
     echo $model_bfield->bfield_id;
 }