public function getNotifikasi($id)
 {
     $client = new Client(HelperController::getHost(), HelperController::getPort());
     $client->getTransport()->setAuth(HelperController::getUserNeo4j(), HelperController::getPassNeo4j());
     $status = 'failed';
     $properties = array();
     $result = array();
     if (count($id) > 0) {
         $cypher = 'MATCH (n:Notifikasi) where n.donaturId="' . $id . '" RETURN n LIMIT 100';
         $query = new Query($client, $cypher);
         $nodes = $query->getResultSet();
         if (count($nodes) > 0) {
             $status = 'success';
             foreach ($nodes as $node) {
                 $properties['id'] = $node['r']->getId();
                 $properties['properties'] = $node['r']->getProperties();
                 array_push($result, $properties);
             }
         } else {
             $status = 'failed, return value is empty check your donatur id';
         }
     } else {
         $status = 'failed, notifikasi id is empty please check your parameter';
     }
     return response()->json(array('status' => $status, 'data' => $result));
 }
Exemplo n.º 2
0
 public function logoutDonatur(Request $request)
 {
     $client = new Client(HelperController::getHost(), HelperController::getPort());
     $client->getTransport()->setAuth(HelperController::getUserNeo4j(), HelperController::getPassNeo4j());
     $donaturId = $request->input('donaturId');
     $status = 'failed';
     if (count($donaturId) > 0) {
         $node = $client->getNode($donaturId);
         if (count($node) > 0) {
             $labels = $node->getLabels();
             $labelName = $labels[0]->getName();
             if ($labelName == HelperController::getLabelDonatur()) {
                 $node->setProperty('gcmId', '')->setProperty('isLogin', 0)->save();
                 $status = 'success';
             } else {
                 $status = 'failed, label not match check your id';
             }
         } else {
             $status = 'failed, nothing to return check your id';
         }
     } else {
         $status = 'failed, id is empty check your id';
     }
     return response()->json(array('status' => $status));
 }
Exemplo n.º 3
0
 /**
  * Update the specified Noticias in storage.
  *
  * @param  int              $id
  * @param UpdateNoticiasRequest $request
  *
  * @return Response
  */
 public function update($id, UpdateNoticiasRequest $request)
 {
     $noticias = $this->noticiasRepository->find($id);
     if (empty($noticias)) {
         Flash::error('Noticias not found');
         return redirect(route('noticias.index'));
     }
     $data = new Noticias($request->all());
     $data = HelperController::controlarCategorias($data);
     $file = $request->file('imagen');
     //TODO Refactoriza este método a uno común para todos los controladores
     if (!is_null($file)) {
         if (Storage::disk('noticias')->exists($noticias->imagen)) {
             Storage::disk('noticias')->delete($noticias->imagen);
         }
         $nombre = Carbon::now() . '_' . $file->getClientOriginalName();
         Storage::disk('noticias')->put($nombre, File::get($file));
         $data->imagen = $nombre;
     }
     $noticias = $this->noticiasRepository->updateRich($data->toArray(), $id);
     Flash::success('Noticias updated successfully.');
     return redirect(route('noticias.index'));
 }
 public function unvalidasiDonasi($id)
 {
     $client = new Client(HelperController::getHost(), HelperController::getPort());
     $client->getTransport()->setAuth(HelperController::getUserNeo4j(), HelperController::getPassNeo4j());
     $status = 'failed';
     if (count($id) > 0) {
         $nodes = $client->getRelationship($id);
         $properties = array();
         if (count($nodes) > 0) {
             $donaturId = $nodes->getProperty('donaturId');
             $nodeDonatur = $client->getNode($donaturId);
             $gcmId = $nodeDonatur->getProperty('gcmId');
             $status = 'success';
             $nodes->setProperty('isValidate', 2)->save();
         } else {
             $status = 'failed, return value is empty check your donasi id';
         }
     } else {
         $status = 'failed, donasi id is empty';
     }
     return response()->json(array('status' => $status));
 }
Exemplo n.º 5
0
 public function updateDonatur(Request $request, $id)
 {
     $client = new Client(HelperController::getHost(), HelperController::getPort());
     $client->getTransport()->setAuth(HelperController::getUserNeo4j(), HelperController::getPassNeo4j());
     $username = $request->input('username');
     $email = $request->input('email');
     $nama = $request->input('nama');
     $notelp = $request->input('notelp');
     $imagePath = $request->input('imagePath');
     $gcmId = $request->input('gcmId');
     $status = 'failed';
     if (count($username) > 0 && count($id) > 0) {
         $cypherCek = 'MATCH (n:' . HelperController::getLabelDonatur() . ') where n.username="******" RETURN n';
         $queryCek = new Query($client, $cypherCek);
         $resultCek = $queryCek->getResultSet();
         if (count($resultCek) > 0) {
             $status = 'failed, data already exist';
         } else {
             $node = $client->getNode($id);
             $node->setProperty('username', $username)->setProperty('email', $email)->setProperty('nama', $nama)->setProperty('notelp', $notelp)->setProperty('imagePath', $imagePath)->setProperty('gcmId', $gcmId)->save();
             $status = 'success';
         }
     } else {
         $status = 'failed, username or id is empty please check your parameter';
     }
     return response()->json(array('status' => $status));
 }
Exemplo n.º 6
0
 public function searchByCategoria()
 {
     $categoria = HelperController::getColumn();
     $query = Recetas::where($categoria, '=', 1);
     return $query;
 }
Exemplo n.º 7
0
 /**
  * Update the specified Restaurantes in storage.
  *
  * @param  int              $id
  * @param UpdateRestaurantesRequest $request
  *
  * @return Response
  */
 public function update($id, UpdateRestaurantesRequest $request)
 {
     $restaurantes = $this->restaurantesRepository->find($id);
     if (empty($restaurantes)) {
         //			Flash::error('Restaurantes not found');
         Flash::error('Restaurante no encontrado');
         return redirect(route('restaurantes.index'));
     }
     $data = new Restaurantes($request->all());
     $data = HelperController::controlarCategorias($data);
     $file = $request->file('imagen');
     if (!is_null($file)) {
         if (Storage::disk('restaurantes')->exists($restaurantes->imagen)) {
             Storage::disk('restaurantes')->delete($restaurantes->imagen);
         }
         $nombre = Carbon::now() . '_' . $file->getClientOriginalName();
         //TODO comprobar extensión
         Storage::disk('restaurantes')->put($nombre, File::get($file));
         //TODO Internacionalizar
         $data->imagen = $nombre;
     }
     $restaurantes = $this->restaurantesRepository->updateRich($data->toArray(), $id);
     //		Flash::success('Restaurantes updated successfully.');
     flash()->success('Restaurante actualizado correctamente.');
     return redirect(route('restaurantes.index'));
 }
 public function updateMustahiq(Request $request, $id)
 {
     $client = new Client(HelperController::getHost(), HelperController::getPort());
     $client->getTransport()->setAuth(HelperController::getUserNeo4j(), HelperController::getPassNeo4j());
     $nama = $request->input('nama');
     $desc = $request->input('desc');
     $tempatLahir = $request->input('tempatLahir');
     $tanggalLahir = $request->input('tanggalLahir');
     $nominal = $request->input('nominal');
     $alamat = $request->input('alamat');
     $latlong = $request->input('latlong');
     $status = $request->input('status');
     $jenjangPendidikan = $request->input('jenjangPendidikan');
     $asalSekolah = $request->input('asalSekolah');
     $alamatSekolah = $request->input('alamatSekolah');
     $namaOrangTua = $request->input('namaOrangTua');
     $alamatOrangTua = $request->input('alamatOrangTua');
     $pekerjaanOrangTua = $request->input('pekerjaanOrangTua');
     $kategori = $request->input('kategori');
     $persentaseBantuan = $request->input('persentaseBantuan');
     $prioritas = $request->input('prioritas');
     $imagePath = $request->input('imagePath');
     $isApproved = $request->input('isApproved');
     $tahunLahir = $request->input('tahunLahir');
     $statusRequest = 'failed';
     if (count($id) > 0) {
         $node = $client->getNode($id);
         $node->setProperty('nama', $nama)->setProperty('desc', $desc)->setProperty('tempatLahir', $tempatLahir)->setProperty('tanggalLahir', $tanggalLahir)->setProperty('alamat', $alamat)->setProperty('latlong', $latlong)->setProperty('status', $status)->setProperty('jenjangPendidikan', $jenjangPendidikan)->setProperty('asalSekolah', $asalSekolah)->setProperty('alamatSekolah', $alamatSekolah)->setProperty('namaOrangTua', $namaOrangTua)->setProperty('alamatOrangTua', $alamatOrangTua)->setProperty('pekerjaanOrangTua', $pekerjaanOrangTua)->setProperty('kategori', $kategori)->setProperty('persentaseBantuan', $persentaseBantuan)->setProperty('prioritas', $prioritas)->setProperty('imagePath', $imagePath)->setProperty('nominal', $nominal)->setProperty('isApproved', $isApproved)->setProperty('tahunLahir', $tahunLahir)->save();
         $statusRequest = 'success';
     }
     return response()->json(array('status' => $statusRequest));
 }
Exemplo n.º 9
0
<?php

use App\Http\Controllers\HelperController;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    return view('welcome');
});
Route::post('city/submit', function () {
    $city = ucfirst(Input::get('city'));
    HelperController::updateInfo($city);
});
Exemplo n.º 10
0
 public function getAllDonasi()
 {
     $client = new Client(HelperController::getHost(), HelperController::getPort());
     $client->getTransport()->setAuth(HelperController::getUserNeo4j(), HelperController::getPassNeo4j());
     $status = 'failed';
     $properties = array();
     $result = array();
     $cypher = 'MATCH (DONATUR)-[r:DONASI]->(MUSTAHIQ) RETURN r LIMIT 100';
     $query = new Query($client, $cypher);
     $nodes = $query->getResultSet();
     if (count($nodes) > 0) {
         $status = 'success';
         foreach ($nodes as $node) {
             $properties['id'] = $node['r']->getId();
             $properties['properties'] = $node['r']->getProperties();
             array_push($result, $properties);
         }
     }
     return response()->json(array('status' => $status, 'data' => $result));
 }
Exemplo n.º 11
0
 public static function gcmPushNotifikasi($from, $gmcId)
 {
     $pesan = self::getPesan($from);
     $collection = PushNotification::app(['environment' => 'production', 'apiKey' => HelperController::getApiKeyGCM(), 'service' => 'gcm'])->to($gmcId)->send($pesan);
 }
Exemplo n.º 12
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function sendRead()
 {
     $members = Member::all();
     //all data of member collection
     $inbox_id = HelperController::getPage();
     $id = Auth::id();
     $author = User::find($id);
     $inbox = Inbox::find($inbox_id);
     //find data in Inbox collection
     $unread = Inbox::where('mail_read', '=', '0')->where('member_id', '=', $id)->get()->count();
     //mailbox view
     return view('vendor/flatAdmin/mailRead', compact(array('members', 'author', 'inbox', 'unread', 'id')));
 }
Exemplo n.º 13
0
 public static function convertCurrentTime()
 {
     $date = date('d-m-y');
     $PresentDate = HelperController::explodeDate($date);
     return $PresentDate;
 }
Exemplo n.º 14
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function handleCreate()
 {
     $user_id = Auth::id();
     $user = User::find($user_id);
     $user_name = $user->first_name;
     $date = HelperController::convertCurrentTime();
     $file = Input::file('file');
     $extension = $file->getClientOriginalExtension();
     // getting file extension
     $fileName = $file->getClientOriginalName();
     //$fileName=  HelperController::explodefile($fileName);//explode the file name and file's extension and retrieve only file name
     $path = '/files/' . $user_name . '/' . $date . '/' . $extension;
     $destinationPath = public_path() . $path;
     // upload path
     $upload_success = $file->move($destinationPath, $fileName);
     // uploading file to given path
     if ($upload_success) {
         $file_name_from_db = HelperController::checkFileName($fileName);
         $file_path_from_db = HelperController::checkFilePath($path);
         if ($fileName != $file_name_from_db && $path != $file_path_from_db) {
             /*
              * file data is stored in database
              * 
              */
             $db_file = new File();
             $db_file->file_name = $fileName;
             $db_file->file_path = 'files/' . $user_name . '/' . $date . '/' . $extension;
             $db_file->save();
             $db_file->members()->attach($user_id);
             //check file extension from extension collection
             $ext_from_db = HelperController::checkExtension($extension);
             if ($extension != $ext_from_db) {
                 $db_file_extension = new Extension();
                 $db_file_extension->file_extension = $extension;
                 $db_file_extension->save();
                 $db_file_extension->files()->attach($db_file);
             } elseif ($extension == $ext_from_db) {
                 //$old_extension=  Extension::where('file_extension','=',$extension)->first();
                 //$extension_id=$old_extension->id;
                 $ext_id = HelperController::getExtensionId($extension);
                 $db_file->extensions()->attach($ext_id);
             }
         }
         return Response::json('success', 200);
     } else {
         return Response::json('error', 400);
     }
     //echo $file;
 }