public function Head_Org($id)
 {
     $head_user = \Input::get('user');
     $org_head = Organization::where('id', '=', $id)->first();
     $org_head->head = $head_user;
     $org_head->save();
     return 1;
 }
 /**
  * Soring an organization head
  * @param type $id 
  * @return type boolean
  */
 public function Head_Org($id)
 {
     // get the user to make organization head
     $head_user = \Input::get('user');
     // get an instance of the selected organization
     $org_head = Organization::where('id', '=', $id)->first();
     $org_head->head = $head_user;
     // save the user to organization head
     $org_head->save();
     return 1;
 }
Exemplo n.º 3
0
 /**
  * user create organisation
  * @return type value
  */
 public function User_Create_Org($id)
 {
     if (Input::get('website') != null) {
         // checking website
         $check = Organization::where('website', '=', Input::get('website'))->first();
     } else {
         $check = null;
     }
     // checking name
     $check2 = Organization::where('name', '=', Input::get('name'))->first();
     if (\Input::get('name') == null) {
         return "Name is required";
     } elseif ($check2 != null) {
         return "Name should be Unique";
     } elseif ($check != null) {
         return "Website should be Unique";
     } else {
         $org = new Organization();
         $org->name = Input::get('name');
         $org->phone = Input::get('phone');
         $org->website = Input::get('website');
         $org->address = Input::get('address');
         $org->internal_notes = Input::get('internal');
         $org->save();
         $user_org = new User_org();
         $user_org->org_id = $org->id;
         $user_org->user_id = $id;
         $user_org->save();
         return 0;
     }
 }
Exemplo n.º 4
0
 /**
  * creating an organization in user profile page via modal popup
  * @param type $id 
  * @return type
  */
 public function User_Create_Org($id)
 {
     // checking if the entered value for website is available in database
     if (Input::get('website') != null) {
         // checking website
         $check = Organization::where('website', '=', Input::get('website'))->first();
     } else {
         $check = null;
     }
     // checking if the name is unique
     $check2 = Organization::where('name', '=', Input::get('name'))->first();
     // if any of the fields is not available then return false
     if (\Input::get('name') == null) {
         return "Name is required";
     } elseif ($check2 != null) {
         return "Name should be Unique";
     } elseif ($check != null) {
         return "Website should be Unique";
     } else {
         // storing organization details and assigning the current user to that organization
         $org = new Organization();
         $org->name = Input::get('name');
         $org->phone = Input::get('phone');
         $org->website = Input::get('website');
         $org->address = Input::get('address');
         $org->internal_notes = Input::get('internal');
         $org->save();
         $user_org = new User_org();
         $user_org->org_id = $org->id;
         $user_org->user_id = $id;
         $user_org->save();
         // for success return 0
         return 0;
     }
 }