public function getSuccessPayment(Request $request) { $admin = User::where(['type' => 'admin'])->first(); $gateway = Omnipay::create('PayPal_Express'); $gateway->setUsername('fai1999.fa_api1.gmail.com'); $gateway->setPassword('N8MALTPJ39RD3MG7'); $gateway->setSignature('AVieiSDlpAV8gE.TnT6kpOEjJbTKAJJakY.PKQSfbkf.rc2Gy1N7vumm'); $gateway->setTestMode(true); $params = Session::get('params'); $response = $gateway->completePurchase($params)->send(); $paypalResponse = $response->getData(); // this is the raw response object if (isset($paypalResponse['PAYMENTINFO_0_ACK']) && $paypalResponse['PAYMENTINFO_0_ACK'] === 'Success') { // Response // print_r($paypalResponse); } else { //Failed transaction } $count = Transaction::where(['transactionid' => $paypalResponse['PAYMENTINFO_0_TRANSACTIONID']])->count(); if ($count < 1) { Transaction::create(['senderid' => Auth::user()->id, 'transactionid' => $paypalResponse['PAYMENTINFO_0_TRANSACTIONID'], 'amount' => $paypalResponse['PAYMENTINFO_0_AMT'], 'recipientid' => $admin->id]); $balance = Balance::where(['userid' => Auth::user()->id])->first(); $balance = $balance->balance + $paypalResponse['PAYMENTINFO_0_AMT']; Balance::where(['userid' => Auth::user()->id])->update(['balance' => $balance]); } if (Auth::user()->type != 'admin') { return redirect()->route('transactions'); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { //$users = Action::all(); $users = $this->_searchQuery(User::where('deleted_at', '=', null))->paginate(20); $context = ['users' => $users]; return view('client.action.index', $context); }
public function update($id) { try { $interest = implode(",", Request::input('interest')); } catch (Exception $e) { } User::where('id', $id)->update(array('name' => Request::input('name'), 'lastname' => Request::input('lastname'), 'username' => Request::input('username'), 'password' => Request::input('password'), 'sex' => Request::input('sex'), 'date_of_birth' => Request::input('date_of_birth'), 'interest' => $interest)); return redirect('data_table'); }
public function main_layout() { $this->data['css_assets'] = AppAssets::load('css', ['bootstrap', 'animate', 'font-awesome', 'icon', 'font', 'app']); $this->data['js_assets'] = AppAssets::load('js', ['jquery', 'bootstrap', 'app', 'jquery-slimscroll', 'app-plugin']); $this->data['title'] = 'Dashboard'; $this->data['member_count'] = User::all()->count(); $this->data['this_month'] = date('Y-m-d', strtotime('-1 Month')); $this->data['new_member_count'] = User::where(DB::raw('DATE(created_at)'), '>=', $this->data['this_month'])->count(); return view('app/components/main_layout')->with('data', $this->data)->nest('content', 'app/home/main', array('data' => $this->data)); }
public function postContactEmail(Request $request) { if (Auth::user()->type == 'student') { $admin = User::where(['type' => 'admin'])->first(); if ($request->hasFile('uploadedfile')) { $filepath = $request->file('uploadedfile')->getRealPath(); $fileextension = $request->file('uploadedfile')->getClientOriginalExtension(); $filetype = $request->file('uploadedfile')->getMimeType(); Mail::send('emails.contacttutor', ['content' => $request->input('message'), 'tutoremail' => $request->input('tutoremail')], function ($message) use($admin, $filepath, $fileextension, $filetype) { $message->from(Auth::user()->email, Auth::user()->name); $message->to($admin->email, 'Admin')->subject('Tutor Time'); $message->attach($filepath, array('as' => 'studentfile.' . $fileextension, 'mime' => $filetype)); }); } else { Mail::send('emails.contacttutor', ['content' => $request->input('message'), 'tutoremail' => $request->input('tutoremail')], function ($message) use($admin) { $message->from(Auth::user()->email, Auth::user()->name); $message->to($admin->email, 'Admin')->subject('Tutor Time'); }); } return redirect()->back()->with('msg', 'Successfully sent message'); } else { return '404 page not found'; } }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $post = Post::findOrFail($id); $nameUser = User::where('id', $post->user_id)->lists('first_name'); return view('admin.post.edit', compact('post', 'nameUser')); }
public function postAdminLesson(Request $request) { if (Auth::user()->type == 'admin') { $student = User::where(['type' => 'student', 'email' => $request->input('studentemail')])->first(); if (count($student) != 0) { $tutor = User::where(['type' => 'tutor', 'email' => $request->input('tutoremail')])->first(); if (count($tutor) == 0) { return redirect()->route('admin.lessons')->with('msg', 'Tutor Not Found........'); } } else { return redirect()->route('admin.lessons')->with('msg', 'Student Not Found........'); } $amount = $request->input('duration') * $tutor->tutorinfo->amount_per_hour; Lesson::create(['studentid' => $student->id, 'tutorid' => $tutor->id, 'date' => $request->input('date'), 'time' => $request->input('time'), 'duration' => $request->input('duration'), 'amount' => $amount]); return redirect()->route('admin.lessons')->with('msg', 'Successfully Added Lesson........'); } else { return redirect()->route('auth.login'); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $users = $this->_searchQuery(User::where('deleted_at', '=', null))->paginate(20); $context = ['users' => $users]; return view('admin.user.index', $context); }