本文整理汇总了PHP中request类的典型用法代码示例。如果您正苦于以下问题:PHP request类的具体用法?PHP request怎么用?PHP request使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了request类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateDepartmentAction
public function updateDepartmentAction(request $request)
{
// Get the ID variable from the request
$id = $request->get('id');
// Create a new Department entity
$department = new Department();
$em = $this->getDoctrine()->getManager();
// Find a department by the ID sent in by the request
$department = $em->getRepository('AppBundle:Department')->find($id);
// Only edit if it is a SUPER_ADMIN
if ($this->get('security.context')->isGranted('ROLE_SUPER_ADMIN')) {
// Create the form
$form = $this->createForm(new CreateDepartmentType(), $department);
// Handle the form
$form->handleRequest($request);
if ($form->isValid()) {
$em->persist($department);
$em->flush();
return $this->redirect($this->generateUrl('departmentadmin_show'));
}
return $this->render('department_admin/create_department.html.twig', array('department' => $department, 'form' => $form->createView()));
} else {
return $this->redirect($this->generateUrl('departmentadmin_show'));
}
}
示例2: update
public function update($id, request $request)
{
$apikeys = ApiKeys::find($id);
$apikeys->imei = $request->input('imei');
$apikeys->save();
return redirect()->intended('clients');
}
示例3: Process
/**
* Initiate the dispacther processes
*
* @param request
*/
public function Process(request $request)
{
$request->Process();
// init this
$this->Initiate();
// create new controller
$c = $request->controller->GetInstance();
// set request as a property in controller
$c->request = $request;
// set view object
$c->view = new \zinux\kernel\view\baseView($request);
// set layout object
$c->layout = new \zinux\kernel\layout\baseLayout($c->view);
$c->view->layout = $c->layout;
// init controller
$c->Initiate();
// call the action method
$c->request->action->InvokeAction($c);
// render : layout ~> view
$c->layout->Render();
// dispose controller
$c->Dispose();
// dispose this
$this->Dispose();
}
示例4: upload
public function upload(request $request)
{
// getting all of the post data
$file = $request->file('file');
// setting up rules
// $rules = array('image' => 'required',); //mimes:jpeg,bmp,png and for max size max:10000
// doing the validation, passing post data, rules and the messages
// $validator = Validator::make($file, $rules);
//if ($validator->fails()) {
// send back to the page with the input data and errors
// return Redirect::to('upload')->withInput()->withErrors($validator);
//}
//else {
// checking file is valid.
if ($file->isValid()) {
$destinationPath = 'assets/img/spelers';
// upload path
$extension = $file->getClientOriginalExtension();
// getting image extension
$fileName = $file->getClientOriginalName();
//.'.'.$extension ; //rand(11111,99999).'.'.$extension; // renameing image
$file->move($destinationPath, $fileName);
// uploading file to given path
// sending back with message
//Session::flash('success', 'Upload successfully');
//return Redirect::to('upload');
}
/*else {
// sending back with error message.
Session::flash('error', 'uploaded file is not valid');
return Redirect::to('upload');
}*/
// }
}
示例5: validateMerchantOtp
public function validateMerchantOtp(request $request)
{
$apiKey = $request->only('api_key');
$validator = Validator::make($apiKey, ['api_key' => 'required']);
if ($validator->fails()) {
$response = response()->json(['response_code' => 'ERR_IAK', 'messages' => 'Invalid Api Key'], 403);
return $response;
}
$role = Role::find(2);
$key = Config::get('custom.JWTkey');
$decoded = JWT::decode($apiKey['api_key'], $key, array('HS256'));
if ($decoded->type != 'merchant') {
return $response = response()->json(['response_code' => 'ERR_IAK', 'messages' => 'Invalid Api Key'], 403);
}
$user = User::find($decoded->sub);
// check the current user
if (empty($user) || !$user->hasRole(['merchant']) || !$user->status) {
return $response = response()->json(['response_code' => 'ERR_IAK', 'messages' => 'Invalid Api Key'], 403);
}
$user_id = $user->id;
$input = $request->only('otp');
$matchThese = ['user_id' => $user_id, 'code' => $input['otp']];
$sms = UserSmsCode::where($matchThese)->first();
if ($sms == '' || empty($sms)) {
return response()->json(['response_code' => 'RES_IOG', 'messages' => 'Invalid OTP Given'], 422);
}
$sms->status = true;
$sms->save();
$user->is_mobile_verified = true;
$user->save();
return response()->json(['response_code' => 'RES_MV', 'messages' => 'Mobile Verified']);
}
示例6: load
/**
* @return array
*/
public function load()
{
$request = new request(self::teams_steam_url, array('start_at_team_id' => $this->get_team_id(), 'teams_requested' => $this->get_teams_requested()));
$teams_info = $request->send();
if (is_null($teams_info)) {
return null;
}
$teams = array();
if (isset($teams_info->teams)) {
$teams_info = (array) $teams_info->teams;
$teams_info = $teams_info['team'];
foreach ($teams_info as $team_info) {
$team_info = (array) $team_info;
$team = new team();
$fields = array_keys($team_info);
foreach ($fields as $field) {
// I hope, that API-response will be changed and players_ids, leagues_ids will become arrays
if (preg_match('/^player_\\d+_account_id$/', $field)) {
$team->add_player_id($team_info[$field]);
continue;
}
if (preg_match('/^league_id_\\d+$/', $field)) {
$team->add_league_id($team_info[$field]);
continue;
}
$team->set($field, (string) $team_info[$field]);
}
$teams[$team->get('team_id')] = $team;
}
return $teams;
}
}
示例7: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(request $request)
{
//
$folder = $request->get('folder');
$data = $this->manager->folderInfo($folder);
return view('admin.upload.index', $data);
}
示例8: load
/**
* @return array
*/
public function load()
{
$request = new request(self::steam_matches_url, $this->_get_data_array());
$xml = $request->send();
if (is_null($xml)) {
return null;
}
$matches = array();
if (isset($xml->matches)) {
$this->_total_results = $xml->total_results;
foreach ($xml->matches as $m_matches) {
foreach ($m_matches as $m) {
$match = new match();
$match->set_array((array) $m);
foreach ($m->players as $players) {
foreach ($players as $player) {
$slot = new slot();
$slot->set_array((array) $player);
$match->add_slot($slot);
}
}
$matches[$match->get('match_id')] = $match;
}
}
}
return $matches;
}
示例9: store
/**
* Store Emails for updates in the future
*
* @return Response
*/
public function store(request $request)
{
$email = new Email();
$email->email = $request->input('email');
$email->save();
return redirect()->back();
}
示例10: __construct
function __construct()
{
$request = new request();
if ($request->checkReq()) {
$this->bearer = $_SERVER['HTTP_BEARER'];
}
}
示例11: updatePoint
public function updatePoint($id, request $request)
{
$hairstyles = hairstyles::find($id);
$hairstyles->Xpoint = $request->input('Xpoint');
$hairstyles->Ypoint = $request->input('Ypoint');
$hairstyles->save();
return redirect()->intended('hairstyles/edit/' . $id);
}
示例12: update
public function update($id, request $request)
{
$categories = Categories::find($id);
$categories->name = $request->input('name');
$categories->description = $request->input('description');
$categories->save();
return redirect()->intended('categories');
}
示例13: load
/**
* @param int $ugcid
* @return object | null
*/
public function load($ugcid = null)
{
if (!is_null($ugcid)) {
$this->_ugcid = $ugcid;
}
$request = new request(self::steam_ugc_url, array('appid' => 570, 'ugcid' => $this->_ugcid));
return $request->send();
}
示例14: load
public function load()
{
$request = new request(self::leagues_prize_pool_steam_url, array('leagueid' => $this->get_league_id()));
$prize_pool = $request->send();
if (is_null($prize_pool)) {
return null;
}
return (array) $prize_pool;
}
示例15: indexAction
public function indexAction(request $request)
{
$searchTerm = $request->query->get('q');
$identifyRepository = $this->getDoctrine()->getRepository('URSearchBundle:Identify');
$categories = $identifyRepository->findCategoryDistributionFor($searchTerm);
$identifiers = $identifyRepository->findAllWithNameLike($searchTerm);
$request->getSession()->set('last_search', $searchTerm);
return $this->render('URSearchBundle:Default:search.html.twig', array('categories' => $categories, 'results' => $identifiers));
}