本文整理汇总了PHP中Illuminate\Http\Request::createFromGlobals方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::createFromGlobals方法的具体用法?PHP Request::createFromGlobals怎么用?PHP Request::createFromGlobals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::createFromGlobals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FileLoader
function __construct()
{
$this->loader = new FileLoader(new Filesystem(), 'lang');
$this->translator = new Translator($this->loader, 'en');
$this->request = Request::createFromGlobals();
$this->validator = $this->initializeValidator();
}
示例2: __call
public function __call($target, $arguments)
{
$symfonyRoutes = $this->symfonyRoutesManager->getConvertedRoutes();
foreach ($symfonyRoutes as $route) {
$current = $route['symfony_controller'] . ':' . $route['symfony_action'];
if ($current == $target) {
if (strstr($target, '.') !== false) {
//Route as a service, dispatch from container.
$controllersService = $this->symfonyContainer->getSymfonyService($route['symfony_controller']);
$actionMethodName = $route['symfony_action'];
$params = Request::createFromGlobals();
//@TODO: params passing should be fixed blemba...
/** @var Response $response */
$response = $controllersService->{$actionMethodName}($this->convertRequest(), 'fos.Router.setData');
if ($response instanceof Response) {
$content = $response->getContent();
} else {
$content = $response;
}
return $content;
}
$actionMethodName = $route["symfony_action"];
$controllerClass = $route["symfony_controller"];
$controllerObj = new $controllerClass();
$controllerObj->setContainer($this->symfonyContainer->getContainer());
$response = $controllerObj->{$actionMethodName}(Request::createFromGlobals());
return $response;
}
}
}
示例3: exportExcel
public function exportExcel($report)
{
$input = Request::createFromGlobals();
$objPHPExcel = $this->createExcelFile($report);
$records = $this->getResults();
// Write header line
$headerRow = 7;
$headerCol = 0;
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'ID');
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Nombre');
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Duración establecida');
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Horas no laborables');
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Horas laborables');
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Total');
// Escribir líneas
$recordRow = 8;
foreach ($records as $record) {
$status = $record->time['status'] == 'ok' ? 'A tiempo' : 'Atrasada';
$recordCol = 0;
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->step_id);
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->step_name);
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->time_hours);
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->elapsed_time['non-work']);
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->elapsed_time['work']);
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->elapsed_time['total']);
$recordRow++;
}
// Set autosize on 50 columns (should be enough)
$nCols = 50;
foreach (range(0, $nCols) as $col) {
$objPHPExcel->getActiveSheet()->getColumnDimensionByColumn($col)->setAutoSize(true);
}
return $this->writeExcelFile($objPHPExcel);
}
示例4: exportExcel
public function exportExcel($report)
{
$input = Request::createFromGlobals();
$objPHPExcel = $this->createExcelFile($report);
$records = $this->getResults();
// Write header line
$headerRow = 7;
$headerCol = 0;
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Periodo BPCS');
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Fecha de inicio');
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Fecha de fin');
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Cantidad');
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Monto');
// Escribir líneas
$recordRow = 8;
foreach ($records as $record) {
$recordCol = 0;
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->name);
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->start);
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->end);
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->cantidad);
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->monto);
$recordRow++;
}
// Set autosize on 50 columns (should be enough)
$nCols = 50;
foreach (range(0, $nCols) as $col) {
$objPHPExcel->getActiveSheet()->getColumnDimensionByColumn($col)->setAutoSize(true);
}
return $this->writeExcelFile($objPHPExcel);
}
示例5: removeRole
public function removeRole()
{
$input = Request::createFromGlobals();
$users = Rol::find($input->rol)->users()->get();
$users->each(function ($user) use($input) {
$user->clases()->attach($input->clase);
});
}
示例6: make
public static function make()
{
if (is_null(self::$instance)) {
$request = \Illuminate\Http\Request::createFromGlobals();
self::$instance = new static($request);
}
return self::$instance;
}
示例7: getDocumento
public function getDocumento($id = '')
{
$input = Request::createFromGlobals();
if ($id == '') {
$id = $input->id;
}
return Documento::with(['lineas.lineas_distribucion', 'lineas_distribucion', 'recepciones_efectivas.ordencompra.clase'])->find($id);
}
示例8: startApplication
/**
* Start Application
*
* @return bool
*/
public function startApplication()
{
$this->router = $this['router'];
require __DIR__ . '/../../../app/routes.php';
$request = Request::createFromGlobals();
$response = $this->router->dispatch($request);
$response->send();
return true;
}
示例9: __construct
/**
* Create a new Illuminate application instance.
*
* @return void
*/
public function __construct()
{
$this['request'] = Request::createFromGlobals();
// The exception handler class takes care of determining which of the bound
// exception handler Closures should be called for a given exception and
// gets the response from them. We'll bind it here to allow overrides.
$this->register(new ExceptionServiceProvider($this));
$this->register(new RoutingServiceProvider($this));
}
示例10: start
public function start()
{
require __DIR__ . '/../routes.php';
try {
$request = Request::createFromGlobals();
$response = $this->router->dispatch($request);
$response->send();
} catch (\Exception $e) {
header("Location: " . $e->getMessage());
exit;
}
}
示例11: bindCoreClasses
/**
* Bind the core classes to the container.
*/
protected function bindCoreClasses()
{
// Bind request
$this->app->bindIf('request', function () {
return Request::createFromGlobals();
});
// Bind config
$this->app->bindIf('config', function ($app) {
return new Repository(['cache' => ['default' => 'file', 'stores' => ['file' => ['driver' => 'file', 'path' => $app['path.storage']]]]]);
}, true);
// Bind cache
$this->app->bindIf('cache', function ($app) {
return new CacheManager($app);
});
}
示例12: addObservacion
public function addObservacion()
{
$input = Request::createFromGlobals();
$record = AccionObservacion::create($input->all());
// Notificar usuario creador
$accion = Accion::with('observaciones')->find($input->accion_id);
$user = User::find($accion->observaciones[0]->responsable);
$observacion = $record;
$html = view('Reclamos.Emails.new_action_comment', compact('user', 'accion', 'observacion'));
echo '<pre>';
print_r($html);
echo '</pre>';
die;
MailController::sendGeneralMail([["email" => $user->user_email]], "Nuevo comentario en acción correctiva/preventiva", $html);
}
示例13: storeMaterialOficina
public function storeMaterialOficina()
{
$input = Request::createFromGlobals();
// Validaciones para materiales de oficina
// Revisar que el código no se repita entre los otros materiales de oficina
$tmp_record = Producto::where('codigo', $input->codigo)->whereHas('clases', function ($query) use($input) {
return $query->where('id_clase', 11);
// Clase para materiales de oficina
})->first();
if ($tmp_record) {
return new AjaxResponse('error', 'Ese código de producto ya existe');
}
$record = Producto::create(['origen' => 'oficina', 'codigo' => $input->codigo, 'nombre' => $input->nombre, 'precio_promedio' => 0, 'dias_promedio' => 0, 'meses_inventario' => 0, 'stock_minimo' => 0, 'stock_maximo' => 0, 'stock_actual' => 0, 'stock_transito' => 0, 'consumo_promedio' => 0, 'unidad' => $input->unidad, 'sugerido' => 0]);
$record->clases()->attach(11);
// Clase para materiales de oficina
return new AjaxResponse('success', '', $record);
}
示例14: bootstrap
public static function bootstrap($errorCallbacks)
{
// Only bootstrap once.
if (static::$bootstrapped) {
return;
}
// Load helper functions.
require_once __DIR__ . '/../../../illuminate/support/Illuminate/Support/helpers.php';
// Directories.
$basePath = str_finish(realpath(__DIR__ . '/..'), '/');
$controllersDirectory = $basePath . 'Controllers';
$modelsDirectory = $basePath . 'Models';
// Register the autoloader and add directories.
ClassLoader::register();
ClassLoader::addDirectories(array($controllersDirectory, $modelsDirectory));
// Instantiate the container.
$app = new Container();
static::$container = $app;
// Tell facade about the application instance.
Facade::setFacadeApplication($app);
// Register application instance with container
$app['app'] = $app;
// Set environment.
$app['env'] = 'production';
// Enable HTTP Method Override.
Request::enableHttpMethodParameterOverride();
// Create the request.
$app['request'] = Request::createFromGlobals();
// Register services.
with(new EventServiceProvider($app))->register();
with(new RoutingServiceProvider($app))->register();
// Register aliases.
foreach (static::$aliases as $alias => $class) {
class_alias($class, $alias);
}
// Load the routes file if it exists.
if (file_exists($basePath . 'routes.php')) {
require_once $basePath . 'routes.php';
}
// Dispatch on shutdown.
register_shutdown_function('Seytar\\Routing\\Router::dispatch', $errorCallbacks);
// Mark bootstrapped.
static::$bootstrapped = true;
}
示例15: bindCoreClasses
/**
* Bind the core classes
*/
public function bindCoreClasses()
{
$this->app->bindIf('request', function () {
return HttpRequest::createFromGlobals();
}, true);
$this->app->bindIf('config', function () {
$fileloader = new FileLoader(new Filesystem(), __DIR__ . '/../config');
return new Config($fileloader, 'config');
}, true);
$this->app->bindIf('cache', function () {
$fileStore = new FileStore(new Filesystem(), __DIR__ . '/../../cache');
return new Cache($fileStore);
});
$this->app->bindIf('session', function () {
return new Session();
}, true);
// Register config file
$this->app['config']->package('anahkiasen/flickering', __DIR__ . '/../config');
}