Пример #1
0
 /**
  * Add new item to the Customer Cart.
  *
  * @return Response
  */
 public function add()
 {
     $itemid = Input::get('itemid');
     $userid = \Auth::user()->id;
     $selqty = Input::get('selqty');
     $itemdata = \DB::select("SELECT A.itemcode, B.aedprice, B.usdprice, B.ispromo, B.promodisc FROM itemmas A LEFT JOIN itemprices B ON A.itemcode = B.itemcode WHERE A.isactive = 1 AND B.isactive = 1 AND B.classid IN (SELECT classid FROM users WHERE id = " . $userid . ") AND A.ID = " . $itemid);
     $cartitem = [];
     $cartitem['userid'] = \Auth::user()->id;
     $cartitem['itemcode'] = $itemdata[0]->itemcode;
     $cartitem['selqty'] = $selqty;
     $cartitem['currency'] = \Auth::user()->currency;
     if ($cartitem['currency'] == 'AED') {
         $itemrate = $itemdata[0]->aedprice;
     } else {
         $itemrate = $itemdata[0]->usdprice;
     }
     if ($itemdata[0]->ispromo == 1) {
         $cartitem['itemrate'] = number_format($itemrate * (1 - $itemdata[0]->promodisc / 100), 2);
     } else {
         $cartitem['itemrate'] = $itemrate;
     }
     $cartitem['totalprice'] = $cartitem['selqty'] * $cartitem['itemrate'];
     $cartitem['updatedby'] = \Auth::user()->id;
     \DB::table('currentcart')->insert($cartitem);
     //dd($cartitem);
 }
Пример #2
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) {
     }
 }
Пример #3
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]);
 }
Пример #4
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');
 }
Пример #5
0
 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;
     //
 }
 /**
  * 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);
 }
Пример #7
0
 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);
 }
 /**
  * checks whether new email is already in the database
  * old and new email can be similler for the selected admin only.
  *
  * @param string        $someString
  *
  * @return string
  */
 public function update(Request $request)
 {
     $email = $request->email;
     $id = $request->id;
     $job = $request->job;
     $firstname = $request->firstname;
     $lastname = $request->lastname;
     $admin = \DB::select('SELECT email FROM users WHERE email = "' . $email . '" not in
                                         (select email from users where id!=' . $id . ')');
     if ($this->CheckInternet()) {
         if ($admin == null) {
             //update
             \DB::table('users')->where('id', $id)->update(['firstname' => $firstname, 'lastname' => $lastname, 'job' => $job, 'email' => $email]);
             $sendMail = new EmailController();
             $content = 'Dear ' . $firstname . ', Your profile been Updated.
                 Your Email is ' . $email . ' Please visit
                 WWW.COUPLEY.COM/cp-admin#/AdminLogin';
             $subject = 'COUPLEY Administrator Update';
             $sendMail->SendMail($email, $firstname, $subject, $content);
             return response()->json(['you can use this email' => $admin, 'status' => 200], 200);
         } else {
             return response()->json(['email' => 'email already exists', 'status' => 201], 201);
         }
     } else {
         return response()->json(['status' => 203], 203);
     }
 }
Пример #9
0
 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'));
 }
Пример #10
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $rodeo = Rodeos::findOrFail($id);
     $potreros = \DB::table('potreros')->lists('nombre', 'id');
     $personal = \DB::table('users')->where('rol', 0)->lists('name', 'id');
     return view('rodeos.edit', array('potreros' => $potreros, 'personal' => $personal, 'rodeo' => $rodeo));
 }
Пример #11
0
 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     $users = \DB::table('users')->join('orders', 'orders.manager', '=', 'users.id')->groupBy('orders.manager')->select('users.*', \DB::raw('count(manager) as total'))->get();
     $orders = new OrderRepository(new Order());
     $managers = $orders->findAllManager('success', 'monitor', ['*'], true);
     return view('home', compact('users', 'managers'));
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Request $request)
 {
     $fromDate = $request['fromDate'] . " 00:00:00";
     $toDate = $request['toDate'] . " 23:59:59";
     $precinct = $request['precinct'];
     if ($precinct == "0") {
         $precinct = "%";
     }
     $department = $request['department'];
     if ($department == "0") {
         $department = "%";
     }
     $category = $request['category'];
     if ($category == "0") {
         $category = "%";
     }
     $status = $request['status'];
     if ($status == "0") {
         $status = "%";
     }
     $reporter = $request['reporter'];
     if ($reporter == "0") {
         $reporter = "%";
     }
     $cases = \DB::table('cases')->join('departments', 'cases.department', '=', 'departments.id')->join('municipalities', 'cases.precinct', '=', 'municipalities.id')->join('users', 'cases.reporter', '=', 'users.id')->join('categories', 'cases.category', '=', 'categories.id')->select(\DB::raw("\n                                        cases.id,\n                                        cases.created_at,\n                                        cases.description,\n                                        cases.status,\n                                        cases.priority,\n                                        cases.severity,\n                                        departments.name as department,\n                                        municipalities.name as precinct,\n                                        IF(`cases`.`addressbook` = 1,(SELECT CONCAT(`FirstName`, ' ', `Surname`) FROM `addressbook` WHERE `addressbook`.`id`= `cases`.`reporter`), (SELECT CONCAT(users.`name`, ' ', users.`surname`) FROM `users` WHERE `users`.`id`= `cases`.`reporter`)) as reporterName,\n                                        categories.name as category\n                                    "))->whereBetween('cases.created_at', array($fromDate, $toDate))->where('municipalities.slug', 'LIKE', $precinct)->where('departments.slug', 'LIKE', $department)->where('categories.slug', 'LIKE', $category)->where('cases.status', 'LIKE', $status)->whereRaw("CONCAT(`users`.`name`, ' ', `users`.`surname`) LIKE '{$reporter}'")->groupBy('cases.id');
     return \Datatables::of($cases)->addColumn('actions', '<a class="btn btn-xs btn-alt" data-toggle="modal" onClick="launchCaseModal({{$id}});" data-target=".modalCase">View</a>')->make(true);
 }
Пример #13
0
 public function updateEdit()
 {
     $data = array('item_name' => Input::get('item_name'), 'item_desc' => Input::get('item_desc'), 'item_desc' => Input::get('item_desc'), 'item_img' => Input::get('item_img'), 'start_bid' => Input::get('start_bid'), 'buy_now_price' => Input::get('buy_now_price'), 'last_bid' => Input::get('last_bid'), 'status' => Input::get('status'), 'start_date' => Input::get('start_date'), 'max_date' => Input::get('max_date'), 'seller' => Input::get('seller'));
     $id = Input::get('id');
     DB::table('items')->where('id', '=', $id)->update($data);
     return Redirect::to('item')->with('message', 'Data berhasil diupdate');
 }
Пример #14
0
 public function getNearLocation()
 {
     $inputs = \Input::get('current_pos');
     $data = json_decode($inputs);
     $builder = \DB::table('events')->where('event_date', '>', date('Y-m-d H:i:s'));
     if (!empty($data->search_string)) {
         $builder = $builder->where('events.name', 'like', '%' . $data->search_string . '%');
     }
     if (!empty($data->filters)) {
         $boardGameIds = [];
         foreach ($data->filters as $boardGameId) {
             $boardGameIds[] = (int) $boardGameId;
         }
         $builder = $builder->whereIn('boardgame_id', $boardGameIds);
     }
     if (!empty($data->search_date)) {
         $builder = $builder->whereDate('event_date', '=', date('Y-m-d', strtotime($data->search_date)));
     }
     if (!empty($data->current_pos->lat)) {
         //todo show only near location
     }
     if (!empty($data->current_pos->lng)) {
         //todo show only near location
     }
     $events = $builder->get();
     $arr = [];
     foreach ($events as $event) {
         $arr[] = ['id' => $event->id, 'lat' => floatval($event->latitude), 'lng' => floatval($event->longitude)];
     }
     return \Response::json($arr);
 }
 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 {
     }
 }
Пример #16
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);
     }
 }
Пример #17
0
 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);
 }
Пример #18
0
 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()];
     //
 }
Пример #19
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);
 }
 /**
  * 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);
 }
Пример #21
0
 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $cat_id = \DB::table('items_category')->insertGetId(array('name' => $request->input('name'), 'description' => $request->input('description')));
     \DB::table('categories_shops')->insert(array('shop_id' => $request->input('shop_id'), 'category_id' => $cat_id));
     $shops = Shops::where('user_id', \Auth::user()->id)->orderBy('id', 'desc')->paginate(5);
     return view('shops::index', compact('shops'));
 }
Пример #22
0
 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';
 }
Пример #23
0
 public function editRecord()
 {
     $name = \Auth::user()->name;
     if (\Request::hasFile('avatar') && \Request::file('avatar')->isValid()) {
         $file = \Request::file('avatar');
         $input = \Request::all();
         $validator = \Validator::make(array('avatar' => $file, 'bio' => $input['bio']), array('avatar' => 'max:800|mimes:jpeg,jpg,gif', 'bio' => 'max:1000'));
         if ($validator->fails()) {
             return redirect('/profile/edit')->withErrors($validator);
         } else {
             if ($input['avatar_path'] == '0') {
                 $unique = str_random(20);
                 $fileName = $unique;
             } else {
                 $fileName = $input['avatar_path'];
             }
             $destinationPath = 'database/pictures/avatars/';
             \Request::file('avatar')->move($destinationPath, $fileName);
             \DB::table('users_data')->where('name', $name)->update(['bio' => $input['bio'], 'avatar' => $fileName]);
             return redirect('/profile/' . $name);
         }
     } else {
         $input = \Request::all();
         $validator = \Validator::make(array('bio' => $input['bio']), array('bio' => 'max:1000'));
         if ($validator->fails()) {
             return redirect('/profile/edit')->withErrors($validator);
         } else {
             \DB::table('users_data')->where('name', $name)->update(['bio' => $input['bio']]);
             return redirect('/profile/' . $name);
         }
     }
 }
Пример #24
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);
     }
 }
Пример #25
0
 /**
  * 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);
 }
Пример #26
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!');
     }
 }
Пример #27
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'));
 }
Пример #28
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;
 }
Пример #29
0
 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();
 }
 public function buscarSubdistribuidores(Request $request)
 {
     if ($request->ajax()) {
         $subdistribuidores = \DB::table('subdistribuidores')->join('users', 'subdistribuidores.emailDistribuidor', '=', 'users.email')->where('users.name', $request['distribuidor'])->get();
     }
     return view('/subdistribuidoresModal', array('subdistribuidores' => $subdistribuidores));
 }