本文整理汇总了PHP中App\Http\Controllers\Session::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::get方法的具体用法?PHP Session::get怎么用?PHP Session::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Controllers\Session
的用法示例。
在下文中一共展示了Session::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_instagram
public function get_instagram()
{
// make sure user is logged in
if (!\Auth::user()) {
return \Redirect::to('/')->withInput()->withErrors('You must be logged in to access the Instagram panel.');
}
// configure the API values
$auth_config = array('client_id' => CLIENT_ID, 'client_secret' => CLIENT_SECRET, 'redirect_uri' => REDIRECT_URI);
// create a new Auth object using the config values
$auth = new \Instagram\Auth($auth_config);
// authorize app if not already authorized
if (!\Input::get('code')) {
$auth->authorize();
}
// get the code value returned from Instagram
$code = \Input::get('code');
$title = 'ImgHost - Instagram';
// save the access token if not already saved
if (!\Session::get('instagram_access_token')) {
\Session::put('instagram_access_token', $auth->getAccessToken($code));
}
// create a new Instagram object
$instagram = new \Instagram\Instagram();
// set the access token on the newly created Instagram object
$instagram->setAccessToken(\Session::get('instagram_access_token'));
// get the ID of the authorized user
$current_user = $instagram->getCurrentUser();
// access the media of the authorized user
$media = $current_user->getMedia();
$db_images = \DB::table('images')->get();
return \View::make('instagram')->with('title', $title)->with('instagram_images', $media)->with('db_images', $db_images);
}
示例2: create
/**
* 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);
}
示例3: getPaymentStatus
public function getPaymentStatus()
{
// Get the payment ID before session clear
$payment_id = \Session::get('paypal_payment_id');
// clear the session payment ID
\Session::forget('paypal_payment_id');
if (empty(\Input::get('PayerID')) || empty(\Input::get('token'))) {
return \Redirect::route('original.route')->with('error', 'Payment failed');
}
$payment = Payment::get($payment_id, $this->_api_context);
// PaymentExecution object includes information necessary
// to execute a PayPal account payment.
// The payer_id is added to the request query parameters
// when the user is redirected from paypal back to your site
$execution = new PaymentExecution();
$execution->setPayerId(\Input::get('PayerID'));
//Execute the payment
$result = $payment->execute($execution, $this->_api_context);
echo '<pre>';
print_r($result);
echo '</pre>';
exit;
// DEBUG RESULT, remove it later
if ($result->getState() == 'approved') {
// payment made
return \Redirect::route('original.route')->with('success', 'Payment success');
}
return \Redirect::route('original.route')->with('error', 'Payment failed');
}
示例4: productList
public function productList()
{
$message = \Session::get('message');
$list = \App\Product::all();
$dimensions = Arrays::dimensionNames();
return view('admin.list', compact('list', 'dimensions', 'message'));
}
示例5: delete
public function delete(Product $product)
{
$cart = \Session::get('cart');
unset($cart[$product->slug]);
\Session::put('cart', $cart);
return redirect()->route('cart-show');
}
示例6: send
protected function send($someData, $headers = [])
{
$token = Session::get('token');
$result = array('token' => $token, 'service' => $this->service, 'data' => $someData);
$this->_setCorsHeaders($headers);
return \Response::json($result, $this->getStatusCode(), $headers);
}
示例7: index
public function index()
{
if (\Session::has("clientid")) {
$clientid = \Session::get("clientid");
$data = array();
$ts = strtotime(date("d.m.Y h:m:i"));
$params["dt_start"] = date("01.m.Y");
$params["dt_end"] = date("d.m.Y");
$query = "SELECT count(DISTINCT a.FOLDERNO) as CNT, count(c.ID) as CNT2 FROM FOLDERS a INNER JOIN ORDERS b ON b.FOLDERNO = a.FOLDERNO INNER JOIN PANELS c ON c.ID = b.PANELID WHERE a.CLIENTID = " . $clientid . " AND a.LOGDATE >= '" . $params["dt_start"] . "' AND a.LOGDATE <= '" . $params["dt_end"] . "'";
$res = $this->DBquery->query($query);
foreach ($res as $row) {
$row = (array) $row;
$data["COUNT"]["FOLDERS"] = $row['CNT'];
$data["COUNT"]["PANELS"] = $row['CNT2'];
}
$query = "SELECT sum(d.COST) AS CNT FROM FOLDERS a LEFT JOIN ORDERS b ON b.FOLDERNO = a.FOLDERNO INNER JOIN PRICES d ON d.PANELID = b.PANELID WHERE a.CLIENTID = " . $clientid . " AND a.LOGDATE >= '" . $params["dt_start"] . "' AND a.LOGDATE <= '" . $params["dt_end"] . "' AND d.PRICELISTID = a.PRICELISTID AND a.PRICELISTID IS NOT NULL";
$res = $this->DBquery->query($query);
foreach ($res as $row) {
$row = (array) $row;
foreach ($row as $k => $v) {
if ($k == 0) {
if ($v == null) {
$data["COUNT"]["SUMM"] = "N/A";
} else {
$data["COUNT"]["SUMM"] = $v . " руб.";
}
}
}
}
return \View::make('stat')->with(['params' => $params, 'ts' => $ts, 'data' => $data]);
} else {
return \View::make('mainPage');
}
}
示例8: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data['title'] = 'Home';
$data['home'] = 1;
$staff = Staff::find(\Session::get('user')->staff_id);
// dd($staff);
if ($staff) {
$classes = array('Please select a class');
foreach ($staff->classes as $class) {
$classes[$class->id] = $class->name;
}
$data['classes'] = $classes;
}
if (session('user')->inRole('coder') || session('user')->inRole('principal')) {
return view('dashboard', $data);
} elseif (session('user')->inRole('head_teacher')) {
return view('dashboard_head_teacher', $data);
} elseif (session('user')->inRole('billing_officer')) {
// return view('dashboard_billing_officer', $data);
return redirect()->route('billing.fee_schedules.index');
} elseif (session('user')->inRole('admin_dept_officer')) {
return view('dashboard_head_teacher', $data);
} else {
return view('unauthorized', $data);
}
}
示例9: upload
public function upload($project_id, Request $request)
{
$user = \Session::get('user');
if (!$user->can('项目文件管理')) {
abort(401);
}
$project = Project::find($project_id);
if ($request->hasFile('file')) {
$path = $request->input('path');
$file = $request->file('file')->getClientOriginalName();
$full_path = \App\NFS::full_path($project, $path);
$full_file = \App\NFS::full_path($project, $path . '/' . $file);
if (file_exists($full_file)) {
$dirname = dirname($full_file) . '/';
$info = \App\NFS::pathinfo($full_file);
$extension = $info['extension'] ? '.' . $info['extension'] : '';
$name = substr($file, 0, strrpos($file, '.') ?: strlen($file));
$suffix_count = 2;
do {
$file_name = $name . '(' . $suffix_count . ')' . $extension;
$full_file = $dirname . $file_name;
++$suffix_count;
} while (file_exists($full_file));
}
$file = substr($full_file, strrpos($full_file, '/') + 1);
\Log::notice(strtr('文件上传: 用户(%name[%id]) 在路径 %path 中上传了文件 %file', ['%name' => $user->name, '%id' => $user->id, '%path' => $full_path, '%file' => $file]));
$request->file('file')->move($full_path, $file);
return redirect()->back()->with('message_content', '上传成功!')->with('message_type', 'info');
} else {
return redirect()->back()->with('message_content', '上传失败')->with('message_type', 'danger');
}
}
示例10: edit
public function edit(Request $request)
{
if (!\Session::get('user')->can('硬件管理')) {
abort(401);
}
$hardware = Hardware::find($request->input('id'));
$old_attributes = $hardware->attributesToArray();
$hardware->name = $request->input('name');
$hardware->description = $request->input('description');
$hardware->model = $request->input('model');
$hardware->self_produce = (bool) ($request->input('self_produce') == 'on');
$new_attributes = $hardware->attributesToArray();
$user = \Session::get('user');
foreach (array_diff_assoc($old_attributes, $new_attributes) as $key => $value) {
$old = $old_attributes[$key];
$new = $new_attributes[$key];
if ($key == 'self_produce') {
$old = $old == 'true' ? '自产' : '外采';
$new = $new == 'true' ? '自产' : '外采';
}
\Log::notice(strtr('硬件修改: 用户(%name[%id]) 修改了硬件 (%hardware[%hardware_id]) 的基本信息: [%key] %old --> %new', ['%name' => $user->name, '%id' => $user->id, '%hardware' => $hardware->name, '%hardware_id' => $hardware->id, '%key' => $key, '%old' => $old, '%new' => $new]));
}
$hardware->save();
return redirect()->back()->with('message_content', '修改成功!')->with('message_type', 'info');
}
示例11: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$campaign = \Session::get('campaign');
$campaign->fillRelations();
foreach ($campaign->getRelations() as $relation) {
foreach ($relation as $title => $components) {
//Split it out into human readable terms
$pieces = explode('\\', $title);
$title_component = $pieces[count($pieces) - 1];
$data['objects'][$title_component] = $components;
}
}
$data['campaigns'] = CampaignMembership::where('user_id', \Auth::user()->id)->get();
foreach ($data['campaigns'] as $campaign) {
$campaign->details;
}
$data['object_count'] = count($data['objects']);
$data['columns'] = 5;
$data['logs'] = QuestLog::where('campaign_id', \Session::get('campaign')->id)->orderBy('id', 'desc')->get();
//Let's remove restricted content for non dms
foreach ($data['logs'] as $key => $value) {
foreach ($value as $component) {
if ($value->restricted == 1 && \Session::get('dm') == 0) {
unset($data['logs'][$key]);
}
}
}
return view('dashboards.index')->with($data);
}
示例12: viewOld
public function viewOld()
{
$error = \Session::get('error');
$messages = \Session::get('messages');
$orders = Order::where('status', '=', Constants::ORDER_VALIDATE)->get();
return view('manager.orderValidated', ['orders' => $orders, 'error' => $error, 'messages' => $messages]);
}
示例13: indexPost
public function indexPost()
{
$tsql = "select coalesce(mail_from,clientname,medname,'ЛПУ') from clients c WHERE c.id = '" . \Session::get('clientid') . "'";
$stmt = $this->DBquery->query($tsql);
if ($stmt === false) {
echo "Error in executing query.<br/>";
die(0);
}
$c = (array) $stmt[0];
$_POST['from'] = str_replace("\"", "'", $c['COALESCE']);
$_POST['to'] = htmlspecialchars($_POST['to']);
$_POST['theme'] = str_replace("\"", "'", $_POST['theme']);
$_POST['body'] = str_replace("\"", "'", $_POST['body']);
//send_mail($_POST['from'], $_POST['to'], $_POST['theme'], $_POST['body'], "https://nacpp.info/print.php?action=viewreport&id=".$folderno."&logo", $folderno);
$tsql = "select logo from clients c WHERE c.id = '" . \Session::get('clientid') . "'";
$stmt = $this->DBquery->query($tsql);
if ($stmt === false) {
echo "Error in executing query.<br/>";
die(0);
}
$c = (array) $stmt[0];
if ($c['LOGO'] == 'Y') {
$c = "&logo";
} else {
$c = "";
}
//$r = send_mail($_POST['from'], $_POST['to'], $_POST['theme'], $_POST['body'], "http://192.168.0.17/nreports/report.php?folderno=".$folderno.$c, $folderno);
$r = FuncControllers::send_mail($_POST['from'], $_POST['to'], $_POST['theme'], $_POST['body'], "http://nacpp.info/print.php?action=viewreport&id=" . \Input::get('folderno') . $c, \Input::get('folderno'));
if ($r == false) {
echo "При отправке письма произошла ошибка!<br/><a href=\"request?folderno=" . \Input::get('folderno') . "\">Вернуться назад</a>";
} else {
echo "Письмо было успешно отправлено!<br/><a href=\"request?folderno=" . \Input::get('folderno') . "\">Вернуться назад</a>";
}
}
示例14: spanish
public function spanish()
{
$tr = new TranslateClient('en', 'es');
$text = Session::get('trans');
$trans = $tr->translate($text);
return view("imageupload")->with(['success' => $text, 'trans' => $trans]);
}
示例15: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$usuario = \App\User::find($id);
$compania = \App\Compania::All()->lists('nombreCompania', 'idCompania');
$rol = \App\Rol::All()->lists('nombreRol', 'idRol');
$tercero = \App\Tercero::where('Compania_idCompania', '=', \Session::get('idCompania'))->lists('nombreCompletoTercero', 'idTercero');
return view('users', compact('compania', 'rol', 'tercero'), ['usuario' => $usuario]);
}