作者:jnax
项目:country-code
/**
* Setup the seeds.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return void
*/
protected function setupSeeds(Application $app)
{
$source = realpath(__DIR__ . '/../database/seeds/');
if ($app instanceof LaravelApplication && $app->runningInConsole()) {
$this->publishes([$source => database_path('seeds')], 'seeds');
}
}
作者:elbakl
项目:blade-extension
/**
* Instanciate and execute all functions as blade extends
*
* @param Application $app The current application
*/
public static function attach(Application $app)
{
/** @var \Illuminate\View\Compilers\BladeCompiler $blade */
$blade = $app->make('view')->getEngineResolver()->resolve('blade')->getCompiler();
$config = $app->make('config');
$class = new static();
if (!isset($class->directivesFile)) {
$class->directivesFile = __DIR__ . '/../directives.php';
}
$blacklist = isset($class->blacklist) ? $class->blacklist : $config->get('blade_extensions.blacklist');
$directives = isset($class->directives) ? $class->directives : $app->make('files')->getRequire($class->directivesFile);
$overrides = isset($class->overrides) ? $class->overrides : $config->get('blade_extensions.overrides', []);
foreach ($overrides as $method => $override) {
if (!isset($directives[$method])) {
continue;
}
if (isset($override['pattern'])) {
$directives[$method]['pattern'] = $override['pattern'];
}
if (isset($override['replacement'])) {
$directives[$method]['replacement'] = $override['replacement'];
}
}
foreach ($directives as $name => $directive) {
$method = 'directive' . ucfirst($name);
if (is_array($blacklist) && in_array($name, $blacklist, true) || !method_exists($class, $method)) {
continue;
}
$blade->extend(function ($value) use($class, $method, $directive, $app, $blade) {
return $class->{$method}($value, $directive['pattern'], $directive['replacement'], $app, $blade);
});
}
}
作者:mvali
项目:package-util
function let(Application $app, ContainerInterface $container)
{
$container->addPackage('mvalim/package')->shouldBeCalled();
$app->make('Mvalim\\PackageUtils\\Container')->willReturn($container);
$this->beAnInstanceOf('spec\\Mvalim\\PackageUtils\\Providers\\CorrectProviderStub');
$this->beConstructedWith($app);
}
作者:gecch
项目:laravel-multidomai
/**
* Bootstrap the given application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public function bootstrap(Application $app)
{
//Detect the domain
$app->detectDomain();
//Overrides the storage path if the domain staorge path exists
$app->useStoragePath($app->domainStoragePath());
}
作者:Scaledes
项目:travally.i
/**
* Setup the migrations.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return void
*/
protected function setupMigrations(Application $app)
{
$source = realpath(__DIR__ . '/../database/migrations/');
if (class_exists('Illuminate\\Foundation\\Application', false) && $app->runningInConsole()) {
$this->publishes([$source => database_path('migrations')], 'migrations');
}
}
作者:tuanlq1
项目:auditin
/**
* Copy migration to resources
*
* @param Application $app
*/
private function initMigration(Application $app)
{
if ($app instanceof \Illuminate\Foundation\Application && $app->runningInConsole()) {
$migrationPath = realpath(__DIR__ . '/../database/migrations');
$this->publishes([$migrationPath => database_path('migrations')]);
}
}
作者:diegopa
项目:testbenc
/**
* Bootstrap the given application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return void
*/
public function bootstrap(Application $app)
{
$items = [];
$app->instance('config', $config = new Repository($items));
$this->loadConfigurationFiles($app, $config);
mb_internal_encoding('UTF-8');
}
作者:dinghu
项目:cr
/**
* Create a new instance of Storytelling.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*/
public function __construct($app)
{
$this->app = $app;
if (method_exists($this, 'initiate')) {
$app->call([$this, 'initiate']);
}
}
作者:alfred-nutile-in
项目:route-trackin
public function boot(Application $app)
{
$source = realpath(__DIR__ . '/migrations/');
if ($app->runningInConsole()) {
$this->publishes([$source => database_path('migrations')], 'migrations');
}
}
作者:B1naryStudi
项目:ascii
public function __construct(Application $app)
{
$providers_classes = config('preview.screenshot_providers');
foreach ($providers_classes as $class) {
$this->providers[] = $app->make($class);
}
}
作者:phech
项目:Gitli
/**
* Register the git client class.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return void
*/
protected function registerGitlib(Application $app)
{
$app->singleton('gitlib', function ($app) {
return new BaseClient(null);
});
$app->alias('gitlib', BaseClient::class);
}
作者:lyonsc
项目:bounded-context-larave
public function __construct(Application $app, Factory $snapshot_factory, $table = 'snapshots_player')
{
$this->app = $app;
$this->connection = $app->make('db');
$this->snapshot_factory = $snapshot_factory;
$this->table = $table;
}
作者:shinichi8
项目:elasticache-larave
public function __construct($memcached, Application $app)
{
$this->memcached = $memcached;
//force expiry to be in seconds from minutes
$this->sessionExpiry = $app->make('config')->get('session.lifetime') * 60;
$this->sessionPrefix = $app->make('config')->get('session.cookie');
}
作者:stevebauma
项目:foundatio
/**
* Bootstrap the given application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return void
*/
public function bootstrap(Application $app)
{
$app->make('orchestra.memory')->extend('user', function ($app, $name) {
$handler = new UserMetaRepository($name, [], $app);
return new UserMetaProvider($handler);
});
}
作者:mlani
项目:g
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$request->secure() && $this->app->environment() === 'production') {
return redirect()->secure($request->getRequestUri());
}
return $next($request);
}
作者:zed
项目:cor
/**
* Determine if the app is running in the console.
*
* To allow testing this will return false the environment is testing.
*
* @return bool
*/
public function isRunningInConsole()
{
if ($this->app->environment('testing')) {
return false;
}
return $this->app->runningInConsole();
}
作者:mubassirhaya
项目:Laravel51-starte
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->app->isDownForMaintenance()) {
throw new HttpException(503);
}
return $next($request);
}
作者:develp
项目:alexa-ap
/**
* Send through our custom router
*
* @param $request
*
* @return Response
*/
protected function sendRequestThroughRouter($request)
{
$this->app->instance('request', $request);
return (new Pipeline($this->app))->send($request)->through($this->middleware)->then(function ($request) {
return $this->router->dispatch($this->alexaRequest);
});
}
作者:jacksun10
项目:streams-platfor
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return void|mixed
*/
public function handle(Request $request, Closure $next)
{
if (!$this->app->isDownForMaintenance()) {
return $next($request);
}
if ($request->segment(1) == 'admin') {
return $next($request);
}
if (in_array($request->getClientIp(), $this->config->get('streams::maintenance.ip_whitelist', []))) {
return $next($request);
}
/* @var UserInterface $user */
$user = $this->guard->user();
if ($user && $user->isAdmin()) {
return $next($request);
}
if ($user && $this->authorizer->authorize('streams::maintenance.access')) {
return $next($request);
}
if (!$user && $this->config->get('streams::maintenance.auth')) {
/* @var Response|null $response */
$response = $this->guard->onceBasic();
if (!$response) {
return $next($request);
}
$response->setContent(view('streams::errors.401'));
return $response;
}
abort(503);
}
作者:CodeWir
项目:larapres
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->app->isDownForMaintenance()) {
return new Response('Be right back!', 503);
}
return $next($request);
}