本文整理汇总了PHP中Illuminate\Support\Facades\App::environment方法的典型用法代码示例。如果您正苦于以下问题:PHP App::environment方法的具体用法?PHP App::environment怎么用?PHP App::environment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\App
的用法示例。
在下文中一共展示了App::environment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ('testing' == App::environment()) {
return $next($request);
}
return parent::handle($request, $next);
}
示例2: getLogin
/**
* @param Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function getLogin(Request $request)
{
if (App::environment('demo')) {
$request->session()->flashInput(['email' => 'admin@societycms.com', 'password' => 'secret']);
}
return view('user::public.login');
}
示例3: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
DB::statement('SET FOREIGN_KEY_CHECKS=0');
if (!App::environment('production')) {
$this->call('UsersTableSeeder');
$this->call('ProfilesTableSeeder');
}
$this->call('RolesTableSeeder');
$this->call('DestinationsTableSeeder');
$this->call('LocationsTableSeeder');
$this->call('MissionTypesTableSeeder');
$this->call('VehiclesTableSeeder');
$this->call('StatisticsTableSeeder');
$this->call('PartsTableSeeder');
$this->call('MissionsTableSeeder');
$this->call('PartFlightsTableSeeder');
$this->call('TagsTableSeeder');
$this->call('NotificationTypesTableSeeder');
$this->call('NotificationsTableSeeder');
$this->call('AstronautsTableSeeder');
$this->call('SpacecraftTableSeeder');
$this->call('SpacecraftFlightsTableSeeder');
$this->call('PayloadsTableSeeder');
$this->call('TelemetryTableSeeder');
$this->call('PrelaunchEventsTableSeeder');
DB::statement('SET FOREIGN_KEY_CHECKS=1');
}
示例4: upload
public function upload(FormUploadRequest $request)
{
$attributes = $request->all();
// fetch the file
$file = $request->file('file');
if (!$file->isValid()) {
throw new Exception('File is not valid');
}
if (App::environment() == 'testing') {
$destinationDir = public_path() . '/testdata/forms';
} else {
$destinationDir = public_path() . '/data/forms';
}
$slug = str_slug($attributes['name']);
$destinationFile = $attributes['year'] . '-' . $slug . '.' . $file->getClientOriginalExtension();
$file->move($destinationDir, $destinationFile);
$form = new Form();
$form->year = $attributes['year'];
$form->name = str_replace('-', '_', str_slug($attributes['name']));
$form->slug = $attributes['year'] . '-' . $slug;
$form->location = str_replace(public_path(), '', $destinationDir . '/' . $destinationFile);
$form->extension = $file->getClientOriginalExtension();
$form->size = filesize($destinationDir . '/' . $destinationFile);
$form->md5 = md5($destinationDir . '/' . $destinationFile);
$form->save();
$resource = new Item($form, new FormTransformer(), 'forms');
return response()->json($this->fractal()->createData($resource)->toArray(), Response::HTTP_CREATED);
}
示例5: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (\Illuminate\Support\Facades\App::environment('local')) {
Schema::drop('settings');
} else {
throw new Exception('Migrating down is prohibited.');
}
}
示例6: postPullRequest
/**
* Run a pull on the QA git repo if merged into master
*
* @return \Illuminate\Http\Response
*/
public function postPullRequest(Request $Request)
{
$request = $Request->all();
if (App::environment() === 'qa' && $request['action'] === 'closed' && $request['pull_request']['merged'] === true && $request['pull_request']['base']['ref'] === 'qa') {
exec('cd /var/www/qa.hometeachme.org/ && git pull');
}
return new Response('pull request received!', 200);
}
示例7: __construct
public function __construct()
{
if (App::environment() == 'testing') {
$this->destinationDir = public_path() . '/testdata/minutes';
} else {
$this->destinationDir = public_path() . '/data/minutes';
}
}
示例8: subscribe
public function subscribe($events)
{
if (empty(Slack::getEndpoint()) || App::environment('local')) {
return;
}
$events->listen('new-signup', [$this, 'onNewSignup']);
$events->listen('new-conference', [$this, 'onNewConference']);
}
示例9: run
public function run()
{
if (App::environment() == 'local') {
//Delete all records from the users table
DB::table('users')->delete();
//Create a demo user
User::create(array('email' => 'user@user.be', 'password' => Hash::make('user'), 'firstname' => 'User', 'lastname' => 'Demo', 'status' => 1));
}
}
示例10: sendAdminEmail
public static function sendAdminEmail($data)
{
Mail::send([], $data, function ($message) use($data) {
$message->to(Config::get('mail.admin_email'));
$message->subject(App::environment() . ': ' . $data['subject']);
$message->setBody(App::environment() . ': ' . $data['text']);
});
return true;
}
示例11: sendEmailPlain
public static function sendEmailPlain($data)
{
Mail::send([], $data, function ($message) use($data) {
$message->to($data['email']);
$message->subject(App::environment() . ': ' . $data['subject']);
$message->setBody(App::environment() . ': ' . $data['text']);
});
return true;
}
示例12: handle
public function handle()
{
if (App::environment() == 'production') {
$this->error("Production? Not sure if I can run this on production");
exit;
}
$this->app_folder = base_path();
$this->repo_name = $this->argument('repo_name');
$this->runScripts();
}
示例13: store
/**
* @param TelegramMessageRequest $request
*
* @return JsonResponse
*/
public function store(TelegramMessageRequest $request)
{
$content = ['chat_id' => StaffTelegramGroup::id(), 'text' => sprintf('(%s) %s', App::environment(), $request->text())];
try {
$message = $this->telegram->sendMessage($content);
$this->webUi->successMessage("Sent message `{$message->getMessageId()}` to staff");
} catch (\Exception $e) {
$this->webUi->errorMessage(sprintf('Failed to send message to staff: %s (%s)', $e->getMessage(), json_encode($content)));
}
return $this->webUi->redirect('telegram.index');
}
示例14: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// && !App::environment('local')
// dd($request->getRequestUri());
if ($request->secure() && !App::environment('local')) {
// return redirect('https://www.colorme.vn');
// return redirect()->secure($request->getRequestUri());
return redirect($request->getRequestUri());
}
return $next($request);
}
示例15: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
if (\Illuminate\Support\Facades\App::environment() === 'local') {
Model::unguard();
$this->cleanDatabase();
$this->call('UserTableSeeder');
$this->call('RoleTableSeeder');
$this->call('PageTableSeeder');
Model::reguard();
}
}