Exemplo n.º 1
0
 public function save_edit()
 {
     $app = app();
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::tokenExtractor($token);
         $users_checker = GlobalLibrary::CheckUsersToken($compare);
         //echo '<pre>'.print_r($compare).'</pre>';
         if ($users_checker[0]) {
             $uid = $users_checker[2];
             $email = $users_checker[3];
             $field_data = array('users_telp' => Request::input('ph'), 'users_description' => Request::input('d'), 'users_fullname' => Request::input('fu'), 'long' => Request::input('long'), 'lat' => Request::input('lat'), 'providerID' => Request::input('provider'), 'deviceVersion' => Request::input('devVersion'), 'deviceBrand' => Request::input('devBrand'), 'deviceID' => Request::input('devID'));
             $data = table_users_detail::find($uid);
             $data->update($field_data);
             return (new Response(array('status' => true, 'msg' => 'Update Profile Success'), 200))->header('Content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed'), 200))->header('Content-Type', "json");
     }
 }
Exemplo n.º 2
0
 public function input()
 {
     $app = app();
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::tokenExtractor($token);
         $users_checker = GlobalLibrary::CheckUsersToken($compare);
         //echo '<pre>'.print_r($compare).'</pre>';
         if ($users_checker[0]) {
             $uname = $users_checker[1];
             $uid = $users_checker[2];
             $email = $users_checker[3];
             $field_user_detail = array('schedule_title' => Request::input('ttl'), 'schedule_type_id' => Request::input('typ'), 'schedule_users_creator' => $uid, 'schedule_users_source' => Request::input('usc'), 'schedule_date_start' => Request::input('dst'), 'schedule_date_end' => Request::input('dnd'), 'schedule_description' => Request::input('des'), 'schedule_headline' => Request::input('hed'), 'schedule_media_id' => Request::input('med'), 'schedule_publish' => Request::input('pub'), 'schedule_repeat' => Request::input('rpt'));
             $schedule = table_schedule::create($field_user_detail);
             return (new Response(array('status' => true, 'msg' => 'success'), 200))->header('content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed1'), 200))->header('content-Type', "json");
     }
 }
Exemplo n.º 3
0
 public function post_request_follower()
 {
     $app = app();
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::tokenExtractor($token);
         $users_checker = GlobalLibrary::CheckUsersToken($compare);
         if ($users_checker[0]) {
             $uname = $users_checker[1];
             $uid = $users_checker[2];
             $email = $users_checker[3];
             $followingid = Request::input('fol', '');
             $follow_requesting = table_request_follow::where('users_id', $uid)->first();
             if ($follow_requesting == null) {
                 $field = array('users_id' => $uid, 'json_request_follow' => $fol . ',');
                 $user = table_request_follow::create($field);
             } else {
                 $field = array('json_request_follow' => $follow_requesting->json_request_follow . $fol . ',');
                 $data2 = table_request_follow::find($uid);
                 $data2->update($field);
             }
             return (new Response(array('status' => true, 'msg' => 'success, request sent'), 200))->header('Content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed1'), 200))->header('Content-Type', "json");
     }
 }
Exemplo n.º 4
0
 public function repost()
 {
     $app = app();
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::tokenExtractor($token);
         $users_checker = GlobalLibrary::CheckUsersToken($compare);
         //echo '<pre>'.print_r($compare).'</pre>';
         if ($users_checker[0]) {
             $uname = $users_checker[1];
             $uid = $users_checker[2];
             $email = $users_checker[3];
             if (Request::input('cid') == null) {
                 return (new Response(array('status' => true, 'msg' => 'Please select a content that you want to repost '), 200))->header('content-Type', "json");
             } else {
                 //get content resource
                 $target = table_content::where('content_id', '=', Request::input('cid'))->first();
                 //input content
                 $field_content = array('content_title' => $target->content_title, 'content_headline' => $target->headline, 'content_detail' => $target->content_detail, 'content_media_id' => $target->content_media_id, 'content_users_uploader' => $uid, 'content_last_editor' => $target->content_last_editor, 'content_date_insert' => date('Y-m-d H:i:s'), 'content_date_expired' => $target->content_date_expired, 'content_publish' => $target->content_publish, 'content_category_id' => $target->content_category_id, 'content_hashtag_id' => $target->content_hashtag_id, 'content_repost_from' => $target->content_id);
                 $content = table_content::create($field_content);
                 //notification repost
                 //input content
                 $field_notiication = array('users_id' => $target->content_users_uploader, 'datetime' => date('Y-m-d H:i:s'), 'status' => 'send');
                 $content = table_notification::create($field_notiication);
                 /*
                 //it always return 1 iterate. i made it but i don't know where a message of notiication store?
                  $dataConverted = array();
                  $app = app();
                  $i=0;
                 $whorepost = table_users_detail::where('users_id', '=',$uid)->first();
                 foreach($whorepost as $row){
                     $dataConverted[$i]->uid = $row->users_id; //send user ID who repost his/her content
                     $dataConverted[$i]->unm = $row->users_name; //send user Name who repost his/her content
                     $dataConverted[$i]->ttl = $target->content_title; //send the Title that reposted
                     $dataConverted[$i]->nci = $whorepost; //send the new content ID to him/her 
                     $dataConverted[$i]->cdi = date('Y-m-d H:i:s'); //send the date repost (insert)
                 
                 }
                 */
                 return (new Response(array('status' => true, 'msg' => 'success'), 200))->header('content-Type', "json");
             }
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed1'), 200))->header('content-Type', "json");
     }
 }