コード例 #1
1
 public function record()
 {
     if (\Request::hasFile('image') && \Request::file('image')->isValid() && \Auth::user()->suspend == false) {
         $file = \Request::file('image');
         $input = \Request::all();
         $date = new \DateTime();
         if (isset($input['anon'])) {
             $name = 'anon';
         } else {
             $name = \Auth::user()->name;
         }
         $validator = \Validator::make(array('image' => $file, 'category' => $input['category'], 'title' => $input['title'], 'caption' => $input['caption']), array('image' => 'required|max:1200|mimes:jpeg,jpg,gif', 'category' => 'required', 'title' => 'required|max:120', 'caption' => 'required|max:360'));
         if ($validator->fails()) {
             return redirect('/publish')->withErrors($validator);
         } else {
             $unique = str_random(10);
             $fileName = $unique;
             $destinationPath = 'database/pictures/stream_' . $input['category'] . '/';
             \Request::file('image')->move($destinationPath, $fileName);
             \DB::insert('insert into public.moderation (p_cat, p_ouser, p_title, p_caption, p_imgurl, p_status, p_reported, p_rating, created_at, updated_at) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [$input['category'], $name, $input['title'], $input['caption'], $unique, 'available', 0, 0, $date, $date]);
             $messages = 'Your content has been succesfully submitted. Going on moderation process.';
             return redirect('/system/notification')->with('messages', $messages);
         }
     } else {
         $messages = 'Your content data is invalid. The process is aborted.';
         return redirect('/system/notification')->with('messages', $messages);
     }
 }
コード例 #2
0
 public function getSensor()
 {
     $id = $_SERVER['REMOTE_ADDR'];
     if (\DB::select('select 1 from module_vanguard where id = ?', [$id])) {
         if (\DB::select('select 1 from app_status where validity = true and sensor_register = true')) {
             $results = \DB::select('select * from module_vanguard where id = ?', [$id]);
             foreach ($results as $result) {
                 $alias = $result->alias;
                 $status = $result->status;
             }
             $timestamp = new \DateTime();
             if ($status == 'active') {
                 $must_report = true;
             }
             if ($status == 'passive') {
                 $must_report = false;
             }
             $is_reported = false;
             \DB::insert('insert into vanguard_log values (?, ?, ?, ?, ?)', [$id, $alias, $must_report, $is_reported, $timestamp]);
             //open to adjustment.
             exec("nodejs /var/www/topsus/nodejs/telegram_check.js");
             return 'OK';
         } else {
             return 'NOT OK - APPLICATION IS NOT LISTENING';
         }
     } else {
         return 'NOT OK - SENSOR IS INVALID';
     }
 }
コード例 #3
0
ファイル: HomeController.php プロジェクト: extjac/qops01
 public function test()
 {
     //return view('test');
     $results = \DB::table('v_tickets')->where('user_id', 11)->get();
     return ['ok' => true, 'code' => 200, 'data' => $results, 'error' => ['message' => 'no errors', 'code' => null]];
     //App\VTicket::all();
 }
コード例 #4
0
 public function index(Request $request)
 {
     /*
      * session()->keep here is used to retain the lesson id even if the user refreshes the page
      * this keeps the lesson id hidden to the user and inaccessible by anyone else
      * the lesson id is not retained when navigating away from the page so the page will be inaccessible once done
      */
     $lessonId = session('lessonId');
     // If lesson id does not exist in the session, do not allow access to the page
     if (!isset($lessonId)) {
         return redirect('lessons');
     }
     $user = auth()->user();
     $words = Word::orderBy(\DB::raw('RAND()'))->take(80)->get();
     $questions = LessonWord::with('word')->where('lesson_id', $lessonId)->get();
     session()->flash('maxQuestions', count($questions));
     if (empty(session('questionIndex'))) {
         session()->flash('questionIndex', 0);
         // Start with index zero
     } else {
         session()->keep('questionIndex');
     }
     $generatedOptions = $this->generateOptions($questions, $words);
     // Pass this to view
     if ($generatedOptions == null) {
         return redirect('lessons');
         // Return users to lesson page if they try to go back to the finished exam
     }
     return view('lessons.exam', ['user' => $user, 'questions' => $questions, 'options' => $generatedOptions]);
 }
コード例 #5
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $status = Input::get('status');
     if ($status == 'comment') {
         $comment_new = User_App_Comment::join('apps', 'apps.id', '=', 'user__app__comments.a_id')->join('users', 'users.id', '=', 'user__app__comments.u_id')->select('user__app__comments.id', 'users.name as user_name', 'users.id as user_id', 'apps.name as app_name', 'apps.id as app_id', 'apps.img_url as app_img', 'comment', 'user__app__comments.created_at')->orderBy('user__app__comments.created_at', 'desc')->take(5)->get();
         return $comment_new;
     }
     //multisearch
     $app_list = App::leftjoin('user__app__favorite', 'user__app__favorite.a_id', '=', 'apps.id')->select('apps.id', 'apps.name', 'apps.img_url', 'apps.rating_users', 'apps.genre', 'apps.rating', \DB::raw('count(user__app__favorite.id) as favorite_count'))->groupBy('apps.id')->orderBy('apps.rating_users', 'desc')->orderBy('id', 'asc');
     if (Input::has('name')) {
         $name = Input::get('name');
         $app_list->where('apps.name', 'LIKE', '%' . $name . '%');
     }
     if (Input::has('genre')) {
         $genre = Input::get('genre');
         $app_list->where('apps.genre', '=', $genre);
     }
     if (Input::has('skip')) {
         $skip = Input::get('skip');
         $app_list->skip($skip);
     }
     $apps = $app_list->take(10)->get();
     if (empty($apps->first())) {
         return Response::json(array('message' => 'Empty Query Man~', 'status' => 'error'));
     } else {
         foreach ($apps as $key => $value) {
             $app_comment_counts = App::join('user__app__comments', 'user__app__comments.a_id', '=', 'apps.id')->where('apps.id', '=', $value['id'])->count();
             //$value->suck_count = $app_suck_counts;
             $value->app_comment = $app_comment_counts;
         }
         return $apps;
     }
 }
コード例 #6
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     try {
         DB::table('dictionary')->where('id', $id)->update(array('word' => \Input::get('word')));
     } catch (Exception $e) {
     }
 }
コード例 #7
0
ファイル: UploadController.php プロジェクト: acmadi/sp2d
 public function anyData(Request $req)
 {
     // $data = Jenissppd::all();
     // $count = App\Flight::where('active', 1)->count();
     $data = \DB::table('jenis_sppd');
     if ($req->get('filter_skdp_id')) {
         $result = $data->where('nama_jenis_sppd', '=', $req->get('filter_skdp_id'))->get();
         // $['rows']=$result;
         return $result;
     }
     if ($req->get('page')) {
         // dd($req->get('page')-1);
         if ($req->get('page') == 1) {
             $offset = $req->get('page') - 1;
         } else {
             $offset = ($req->get('page') - 1) * $req->get('rows');
         }
         $data->skip($offset);
     }
     if ($req->get('rows')) {
         $data->take($req->get('rows'));
     }
     $datax['rows'] = $data->get();
     $total['total'] = \DB::table('jenis_sppd')->count();
     // dd($data->get());
     return $total + $datax;
     //
 }
コード例 #8
0
 public function inbox()
 {
     $name = \Auth::user()->name;
     $results = \DB::select('select * from notification.inbox_' . $name . ' order by created_at desc limit 70 offset 0');
     \DB::update('update notification.inbox_' . $name . ' set n_read = true');
     return view('profile.inbox')->with('results', $results);
 }
コード例 #9
0
 public function getIndex()
 {
     //Obtiene todo valores
     $result = \DB::table('users')->get();
     //Realizar un select a ciertos campos
     $result = \DB::table('users')->select(['first_name', 'last_name'])->get();
     //Realizar un select con un where
     // where  (campo,operacion,valor)
     $result = \DB::table('users')->select(['first_name', 'last_name'])->where('first_name', '<>', 'Admin')->get();
     //Realizar un select con un orderBY ASC
     // order  (campo,tipo)
     $result = \DB::table('users')->select(['first_name', 'last_name'])->where('first_name', '<>', 'Admin')->orderBy('first_name', 'ASC')->get();
     //Realizar un select con un join
     //join (tablajoin,tabla1.campo_id,'=',table2.campo_id)
     // Al comentar el select se encuentran diferentes ids
     $result = \DB::table('users')->where('first_name', '<>', 'Admin')->orderBy('first_name', 'ASC')->join('user_profiles', 'users.id', '=', 'user_profiles.user_id')->get();
     //Delimitar la consulta con el join para no tener errores de ids
     $result = \DB::table('users')->select('users.id', 'first_name', 'last_name', 'user_profiles.id as profiles_id')->where('first_name', '<>', 'Admin')->orderBy('first_name', 'ASC')->join('user_profiles', 'users.id', '=', 'user_profiles.user_id')->get();
     //Obetener todos los campos de una table y de otra ciertos campos
     $result = \DB::table('users')->select('users.*', 'user_profiles.id as profiles_id_table', 'user_profiles.user_id as user_relation', 'user_profiles.twitter')->where('first_name', '<>', 'Admin')->orderBy('first_name', 'ASC')->join('user_profiles', 'users.id', '=', 'user_profiles.user_id')->get();
     //Incluir a los usuarios que no tiene perfil (administrador)
     $result = \DB::table('users')->select('users.*', 'user_profiles.id as profiles_id_table', 'user_profiles.user_id as user_relation', 'user_profiles.twitter')->orderBy('first_name', 'ASC')->leftJoin('user_profiles', 'users.id', '=', 'user_profiles.user_id')->get();
     //Muestra contraida la informacion
     dd($result);
     return $result;
 }
コード例 #10
0
 public function post_upload()
 {
     // fetch input data
     $input = \Input::all();
     // create rules for validator
     $rules = array('image' => 'required|image|max:5000', 'description' => 'required|max:100');
     // validate the data with set rules
     $v = \Validator::make($input, $rules);
     if ($v->fails()) {
         // if validation fails, redirect back with relevant error messages
         return \Redirect::back()->withInput()->withErrors($v);
     } else {
         $image = \Input::file('image');
         // URL::to('/') can be changed to public_path() on a public domain
         $directory = \URL::to('/') . '/uploads/';
         $mkdir = public_path() . '/uploads/';
         // create directory if it doesn't exist
         if (!file_exists($mkdir)) {
             \File::makeDirectory($mkdir, 0775, true);
         }
         // save the filename with the path and a unique name for the file
         $filename = uniqid() . '.' . $input['image']->getClientOriginalExtension();
         // move the file to the correct path
         $upload_success = $input['image']->move($mkdir, $filename);
         $full_path = $directory . $filename;
         // store image info in the database
         \DB::table('images')->insert(['description' => \Input::get('description'), 'image' => $full_path, 'user_id' => \Auth::user()->id, 'approved' => 0, 'created_at' => \Carbon\Carbon::now()->toDateTimeString()]);
         return \Redirect::back()->withInput()->withErrors('Upload Successful!');
     }
 }
コード例 #11
0
 /**
  * Edit timeline /
  */
 public function editTimeline($timeline_id, Request $request)
 {
     $timeline = \App\Timeline::where('id', '=', $timeline_id)->first();
     $timeline_events = $timeline->event()->orderBy('start_date')->get();
     if ($request->input('showForm') == 'true') {
         return view('timelines.editTimeline')->with('showForm', 'true')->with('timeline', $timeline)->with('timeline_events', $timeline_events);
     } else {
         // Else submit form
         // Validate the request data
         $this->validate($request, ['name' => 'required']);
         $user = \Auth::user();
         $timeline->name = $request->input('name');
         $timeline->description = $request->input('description');
         $timeline->last_modified_by = $user->id;
         $timeline->save();
         // Delete events
         for ($e = 0; $e < count($timeline_events); $e++) {
             if ($request->input('delete_event' . $e) == 'true') {
                 \DB::table('character_event')->where('event_id', '=', $timeline_events[$e]->id)->delete();
                 \DB::table('event_location')->where('event_id', '=', $timeline_events[$e]->id)->delete();
                 $event = \App\Event::where('id', '=', $timeline_events[$e]->id)->first();
                 if ($event) {
                     $event->delete();
                 }
             }
         }
         // Return success message
         return view('timelines.editTimeline')->with('showForm', 'false')->with('timeline', $timeline);
     }
 }
コード例 #12
0
ファイル: TaskController.php プロジェクト: DiCore/hours
 public function postFinishedtask()
 {
     $reservedhour = \App\ReservedHours::find(\Request::input('hour_id'));
     \App\FinishedHour::create(array('user_id' => $reservedhour->user_id, 'service_id' => $reservedhour->service_id, 'client' => $reservedhour->client, 'price' => $reservedhour->service->price, 'created_at' => date('Y-m-d')));
     \DB::table('reservedhours')->where('id', '=', $reservedhour->id)->delete();
     return 'true';
 }
 /**
  * handle data posted by ajax request
  */
 public function create()
 {
     $id = \Auth::user()->id;
     $term = \Session::get('term');
     $subject_id = \Session::get('subject_id');
     $act_name = \Input::get('deletable');
     $query = \DB::table('records')->where('enrollment_faculty_load_id', $subject_id)->where('term', $term)->select('records.id as records_id')->get();
     $recid = json_decode(json_encode($query), true);
     foreach ($recid as $key => $value) {
         $query = \DB::table('grades')->where('records_id', $value)->select('id')->get();
         $gid[] = json_decode(json_encode($query), true);
     }
     foreach ($gid as $key => $data) {
         foreach ($data as $key2 => $data2) {
             $grades_id[] = $data2['id'];
         }
     }
     foreach ($grades_id as $key => $data) {
         \DB::table('grades')->where('id', $data)->where('name', $act_name)->delete();
     }
     \DB::table('selected_activities')->where('load_id', $subject_id)->where('term', $term)->where('act_name', $act_name)->delete();
     \DB::table('activities')->join('records', 'records.id', '=', 'activities.records_id')->where('records.enrollment_faculty_load_id', $subject_id)->where('records.term', $term)->where('act_name', 'LIKE', $act_name . '%')->delete();
     $response = 'The activity named ' . $act_name . ' has been deleted.';
     return \Response::json($response);
 }
コード例 #14
0
ファイル: UnitkerjaController.php プロジェクト: acmadi/sp2d
 public function anyData(Request $req)
 {
     // $data = Unitkerja::all();
     // $count = App\Flight::where('active', 1)->count();
     // $data = \DB::table('unit_kerja');
     $data = Unitkerja::with('skpd');
     // dd($data->get());
     if ($req->get('filter_skdp_id')) {
         $result = $data->where('skpd_id', '=', $req->get('filter_skdp_id'))->get();
         // $['rows']=$result;
         // return $result;
         $datax['rows'] = $this->show_relasi_kolom($result);
         // return $this->show_relasi_kolom($result);
         return $datax + ['token' => csrf_token()];
     }
     if ($req->get('page')) {
         // dd($req->get('page')-1);
         if ($req->get('page') == 1) {
             $offset = $req->get('page') - 1;
         } else {
             $offset = ($req->get('page') - 1) * $req->get('rows');
         }
         $data->skip($offset);
     }
     if ($req->get('rows')) {
         $data->take($req->get('rows'));
     }
     // $datax['rows']=$data->get();
     // $datax['rows']=$this->show_relasi_kolom($data->get(),'skpd','nama_skpd','skpd');
     $datax['rows'] = $this->show_relasi_kolom($data->get());
     $total['total'] = \DB::table('unit_kerja')->count();
     // dd($data->get());
     return $total + $datax + ['token' => csrf_token()];
     //
 }
コード例 #15
0
 /**
  * reset uses to check,
  * whether user is registered,
  *  if it is, then update new password.
  *
  * @return string
  */
 public function reset(Request $request)
 {
     $credentials = $request->only('email', 'password');
     $newpassword = $request->newpassword;
     $mail = $request->email;
     try {
         // verify the credentials and create a token for the user
         if (!($token = JWTAuth::attempt($credentials))) {
             return response()->json(['error' => 'invalid_credentials', 'status' => 201], 201);
         }
     } catch (JWTException $e) {
         // something went wrong
         return response()->json(['error' => 'could_not_create_token', 'status' => 500], 500);
     }
     if ($this->CheckInternet()) {
         $adminName = \DB::select('SELECT firstname FROM users WHERE email = "' . $mail . '"');
         $sendMail = new EmailController();
         $content = 'Dear Administrator, your updated password is ' . $newpassword;
         $subject = 'COUPLEY Password Update';
         $sendMail->SendMail($mail, $adminName[0]->firstname, $subject, $content);
         $hashed = \Hash::make($newpassword);
         \DB::table('users')->where('email', $mail)->update(['password' => $hashed]);
         return response()->json(['password' => 'uptodate', 'status' => 200], 200);
     } else {
         return response()->json(['error' => 'No_network', 'status' => 203], 203);
     }
 }
コード例 #16
0
ファイル: PageController.php プロジェクト: kjellberg/affecms
 /**
  * Display FRONT PAGE
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $programs = \App\Program::orderBy(\DB::raw('RAND()'))->take(4)->get();
     $programs_high_bonus = \App\Program::orderBy(\DB::raw('RAND()'))->take(4)->get();
     $program_logos = \App\Program::get(array('logo_bgcolor', 'slug'));
     return view(\App\Template::view('page.front-page'))->with(['menu_item' => 'home', 'edit_mode' => false, 'programs' => $programs, 'programs_high_bonus' => $programs_high_bonus, 'program_logos' => $program_logos]);
 }
コード例 #17
0
 public function actualiza(Request $request, $id)
 {
     $cantdb = \DB::table('productos')->select('CantExistente')->where('ID', $id)->first();
     $cantinput = $request->input('cantidads');
     $resul = $cantdb->CantExistente - intval($cantinput);
     \DB::table('productos')->where('ID', $id)->update(['CantExistente' => $resul]);
     $productoid = \DB::table('productos')->select('ID')->where('ID', $id)->first();
     $cantinput = $request->input('cantidads');
     $nombreus = $request->input('usuarios');
     $nombreus2 = \DB::table('usuarios')->select('Nombre')->where('ID', $nombreus)->first();
     $nombrpr = \DB::table('productos')->select('Nombre')->where('ID', $id)->first();
     $salida = new salidasModelo();
     $salida->Producto_ID = $productoid->ID;
     $salida->Nombre_Producto = $nombrpr->Nombre;
     $salida->Cantidad = intval($cantinput);
     $salida->Usuario_ID = intval($nombreus);
     $salida->Nombre_salida = $nombreus2->Nombre;
     $salida->save();
     /*  $salida=salidasModelo::getInfoSalida($id);
         dd($salida);
         $vista = view('generapdf', compact($salida));
         $dompdf = \App::make('dompdf.wrapper');
         $dompdf->loadHTML($vista);
         return $dompdf->stream();*/
     return Redirect()->back();
     //    return view('generapdf');
 }
コード例 #18
0
 public function autocomplete()
 {
     dd(Input::get('companyName'));
     if (Input::get('companyName')) {
         $term = Input::get('term');
         $results = array();
         $queries = \DB::table('emp_table')->where('emp_name', 'LIKE', '%' . $term . '%')->take(5)->get();
         foreach ($queries as $query) {
             $results[] = ['id' => $query->id, 'value' => $query->company_name];
         }
         return \Response::json($results);
     }
     if (Input::get('employeeName')) {
         dd('lkhkhlk');
         $term = Input::get('term');
         $results = array();
         $queries = \DB::table('emp_table')->where('emp_name', 'LIKE', '%' . $term . '%')->where('emp_status', '=', 'Active')->take(5)->get();
         foreach ($queries as $query) {
             $results[] = ['id' => $query->emp_id, 'value' => $query->emp_name];
         }
         dd('sss');
         return \Response::json($results);
     } else {
     }
 }
コード例 #19
0
 public function indexjson($month, $year)
 {
     $eventList1 = Events::where('e_type', 'single')->where(\DB::raw('MONTH(e_date)'), '=', $month)->where(\DB::raw('YEAR(e_date)'), '=', $year)->orWhere('e_type', 'annual')->where(\DB::raw('MONTH(e_date)'), '=', $month)->where(\DB::raw('YEAR(e_date)'), '<=', $year)->get();
     $eventList2 = Events::where('e_type', '!=', 'single')->where('e_type', '!=', 'annual')->get();
     $eventList = $eventList1->merge($eventList2);
     return response()->json($eventList);
 }
コード例 #20
0
ファイル: VerbController.php プロジェクト: anthon94/p4
 public function postQuery(Request $request)
 {
     // User::where(function($query) {
     // $query->where('name', '=', 'John')
     //       ->orWhere('votes', '>', 100);
     // })
     // ->get();
     $this->validate($request, ['infinitive_it' => 'min:2', 'infinitive_en' => 'min:2', 'gerund_it' => 'min:2', 'past_part_it' => 'min:2']);
     // $infinitive_it = $request->infinitive_it;
     // $infinitive_en = $request->infinitive_en;
     // $gerund_it = $request->gerund_it;
     // $past_part_it = $request->past_part_it;
     // $verbs = new \App\Verb();
     // $verbs = \App\Verb::where(function($query) use ($request){
     //             $query->Where($verbModel->infinitive_it, '=', $request->infinitive_it)
     //                   ->orWhere($verbModel->infinitive_en, 'LIKE', $infinitive_en)
     //                   ->orWhere($verbModel->gerund_it, '=', $gerund_it)
     //                   ->orWhere($verbModel->past_part_it, '=', $past_part_it);
     //         })
     //         ->get();
     $verbs = \DB::table('verbs')->orWhere('infinitive_it', '=', $request->infinitive_it)->orWhere('infinitive_en', '=', $request->infinitive_en)->orWhere('gerund_it', '=', $request->gerund_it)->orWhere('past_part_it', '=', $request->past_part_it)->get();
     //dump($verbs);
     //dump($request);
     if (empty($verbs)) {
         \Session::flash('flash_message', 'Verb not found.');
         return redirect('/verbs/query');
     }
     return view('verbs.query')->with('verbs', $verbs)->with('request', $request);
 }
コード例 #21
0
ファイル: PostController.php プロジェクト: calimanleontin/bet
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(PostFormRequest $request)
 {
     $title = $request->get('title');
     $duplicate = \DB::table('posts')->where('title', $title)->get();
     //		var_dump($duplicate);
     //		die();
     if ($duplicate != null) {
         return redirect('/new-post')->withErrors('A post with this title already exists');
     }
     $post = new Posts();
     $post->title = $request->get('title');
     $post->body = $request->get('body');
     $post->slug = str_slug($post->title);
     $post->author_id = $request->user()->id;
     $category_id = $request->get('category');
     //		var_dump($category_id);
     //		die();
     $post->category_id = $category_id;
     if ($request->has('save')) {
         $post->active = 0;
         $message = 'Post saved successfully';
     } else {
         $post->active = 1;
         $message = 'Post published successfully';
     }
     $post->save();
     return redirect('edit/' . $post->slug)->withMessage($message);
 }
コード例 #22
0
 /**
  * Display a listing of the resource.
  *
  * @return Respon
  */
 public function index(Request $request)
 {
     //return 'listado la configuracion de la base de datos';
     $conf = \DB::table('configuracion')->orderBy('id', 'ASC')->paginate(5);
     //->get()
     return view('configuracion.index')->with('datos', $conf)->with('buscar', $request->buscar);
 }
コード例 #23
0
 public function show($id)
 {
     $transaksi = \DB::table('transaksis')->join('users', 'users.id', '=', 'transaksis.user_id')->get();
     $data['transaksi'] = $transaksi;
     $nasabah = Nasabah::find($id);
     return view('nasabah.show', compact('nasabah', 'transaksi'));
 }
コード例 #24
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $level = \DB::select('select *from levels order by id desc');
     $data = \DB::table('levels')->where('id', '=', $id)->first();
     //untuk mengambil data berdasarkan id
     return view('level/edit')->with('data', $data, $level);
 }
コード例 #25
0
ファイル: HomeController.php プロジェクト: stiwarih/p4
 public function debug()
 {
     echo '<pre>';
     echo '<h1>Environment</h1>';
     echo \App::environment() . '</h1>';
     echo '<h1>Debugging?</h1>';
     if (config('app.debug')) {
         echo "Yes";
     } else {
         echo "No";
     }
     echo '<h1>Database Config</h1>';
     /*
     The following line will output your MySQL credentials.
     Uncomment it only if you're having a hard time connecting to the database and you
     need to confirm your credentials.
     When you're done debugging, comment it back out so you don't accidentally leave it
     running on your live server, making your credentials public.
     */
     //print_r(config('database.connections.mysql'));
     echo '<h1>Test Database Connection</h1>';
     try {
         $results = \DB::select('SHOW DATABASES;');
         echo '<strong style="background-color:green; padding:5px;">Connection confirmed</strong>';
         echo "<br><br>Your Databases:<br><br>";
         print_r($results);
     } catch (Exception $e) {
         echo '<strong style="background-color:crimson; padding:5px;">Caught exception: ', $e->getMessage(), "</strong>\n";
     }
     echo '</pre>';
 }
コード例 #26
0
ファイル: BajasController.php プロジェクト: iarmoa/gaia
 public function ajaxStoreBajas(Requests\BajasRequest $request)
 {
     $baja = new Bajas($request->all());
     \Auth::user()->bajas()->save($baja);
     \DB::table('animales')->where('id', $baja->animal_id)->update(['estado' => 'Baja']);
     return redirect()->route('rodeos.show', $baja->rodeo_id);
 }
コード例 #27
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $selectlist = \DB::table('presentations')->orderBy('presentationName')->lists('presentationName', 'id');
     $emptyOption = array('0' => '------');
     $selectlist = $emptyOption + $selectlist;
     return view('presentations.edit', ['presentationID' => $selectlist, 'selectedID' => $id]);
 }
コード例 #28
0
 public function login_auth()
 {
     $user_id = Request::get('user_id');
     $user_password = Request::get('user_password');
     $result_list = \DB::select(\DB::raw("SELECT * FROM user_table"));
     foreach ($result_list as $result) {
         if ($result->user_id == $user_id) {
             if ($result->user_password == $user_password) {
                 if ($result->user_type == 'admin') {
                     $_SESSION['TICKET_USER_ID'] = $user_id;
                     $_SESSION['TICKET_USER_TYPE'] = $user_type;
                     return view('ticket_views.home');
                 }
                 if ($result->user_type == 'user') {
                     $client_id = $result->client_id;
                     if ($client_id == 'c_robi') {
                         $_SESSION['TICKET_USER_ID'] = $user_id;
                         $_SESSION['TICKET_USER_TYPE'] = $result->user_type;
                         $_SESSION['TICKET_USER_CLIENT_ID'] = $client_id;
                         $_SESSION['TICKET_USER_CLIENT_TYPE'] = 'telco';
                         return view('ticket_views.create_ticket_client');
                     }
                 }
             }
         }
     }
 }
コード例 #29
0
ファイル: StorageController.php プロジェクト: hunglmtb/eb
 protected function afterSave($resultRecords, $occur_date)
 {
     //     	\DB::enableQueryLog();
     $tankDataValue = TankDataValue::getTableName();
     $tank = Tank::getTableName();
     $columns = [\DB::raw("sum(BEGIN_VOL) \tas\tBEGIN_VOL"), \DB::raw("sum(END_VOL) \t\t\tas\tEND_VOL"), \DB::raw("sum(BEGIN_LEVEL) \t\tas\tBEGIN_LEVEL"), \DB::raw("sum(END_LEVEL) \t\tas\tEND_LEVEL"), \DB::raw("sum(TANK_GRS_VOL) \t\tas\tGRS_VOL"), \DB::raw("sum(TANK_NET_VOL) \t\tas\tNET_VOL"), \DB::raw("sum(AVAIL_SHIPPING_VOL) as\tAVAIL_SHIPPING_VOL")];
     $attributes = ['OCCUR_DATE' => $occur_date];
     $storage_ids = [];
     foreach ($resultRecords as $mdlName => $records) {
         //     		$mdl = "App\Models\\".$mdlName;
         //     		$mdlRecords = $mdl::with('Tank')->whereIn();
         foreach ($records as $mdlRecord) {
             $storageID = $mdlRecord->getStorageId();
             if ($storageID) {
                 $storage_ids[] = $storageID;
             }
         }
     }
     $storage_ids = array_unique($storage_ids);
     foreach ($storage_ids as $storage_id) {
         $values = TankDataValue::join($tank, function ($query) use($tankDataValue, $tank, $storage_id) {
             $query->on("{$tank}.ID", '=', "{$tankDataValue}.TANK_ID")->where("{$tank}.STORAGE_ID", '=', $storage_id);
         })->whereDate('OCCUR_DATE', '=', $occur_date)->select($columns)->first();
         $attributes['STORAGE_ID'] = $storage_id;
         $values = $values->toArray();
         $values['STORAGE_ID'] = $storage_id;
         $values['OCCUR_DATE'] = $occur_date;
         StorageDataValue::updateOrCreate($attributes, $values);
     }
     //     	\Log::info(\DB::getQueryLog());
 }
コード例 #30
0
ファイル: SupportController.php プロジェクト: Kadexi/CSGOVoid
 public function ticket($ticketId)
 {
     $loots = \DB::table('lootgames')->join('loot', function ($join) {
         $join->on('lootgames.id', '=', 'loot.game_id')->where('loot.user_id', '=', $this->user->id);
     })->join('users', 'lootgames.user_id', '=', 'users.id')->groupBy('lootgames.id')->orderBy('lootgames.id', 'desc')->select('lootgames.*', 'users.username as winner_username', 'users.steamid64 as winner_steamid64', 'users.avatar as winner_avatar')->orderBy('id', 'steam_price')->get();
     return view('support.ticket', compact('loots'));
 }