当前位置: 首页>>代码示例>>PHP>>正文


PHP App::environment方法代码示例

本文整理汇总了PHP中App::environment方法的典型用法代码示例。如果您正苦于以下问题:PHP App::environment方法的具体用法?PHP App::environment怎么用?PHP App::environment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App的用法示例。


在下文中一共展示了App::environment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postLogin

 /**
  * Handle a login request to the application.
  *
  * @param \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function postLogin(\Illuminate\Http\Request $request)
 {
     if (\App::environment('local')) {
         $this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required']);
     } else {
         $this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required', 'g-recaptcha-response' => 'required|recaptcha']);
     }
     // If the class is using the ThrottlesLogins trait, we can automatically throttle
     // the login attempts for this application. We'll key this by the username and
     // the IP address of the client making these requests into this application.
     $throttles = $this->isUsingThrottlesLoginsTrait();
     if ($throttles && $this->hasTooManyLoginAttempts($request)) {
         return $this->sendLockoutResponse($request);
     }
     $credentials = $this->getCredentials($request);
     if (\Auth::attempt($credentials, $request->has('remember'))) {
         return $this->handleUserWasAuthenticated($request, $throttles);
     }
     // If the login attempt was unsuccessful we will increment the number of attempts
     // to login and redirect the user back to the login form. Of course, when this
     // user surpasses their maximum number of attempts they will get locked out.
     if ($throttles) {
         $this->incrementLoginAttempts($request);
     }
     return redirect($this->loginPath())->withInput($request->only($this->loginUsername(), 'remember'))->withErrors([$this->loginUsername() => $this->getFailedLoginMessage()]);
 }
开发者ID:amirmasoud,项目名称:chakoshLaravelBlog,代码行数:33,代码来源:AuthController.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     /* CONFIG::ALL */
     $this->call('PlanSeeder');
     $this->call('WidgetDescriptorSeeder');
     /* CONFIG::LOCAL ONLY */
     if (App::environment('local')) {
         Eloquent::unguard();
         $this->call('UserSeeder');
         $this->call('InitialSeeder');
         /* CONFIG::DEVELOPMENT ONLY */
     } else {
         if (App::environment('development')) {
             Eloquent::unguard();
             $this->call('UserSeeder');
             $this->call('InitialSeeder');
             /* CONFIG::STAGING ONLY */
         } else {
             if (App::environment('staging')) {
                 /* Nothing here */
                 /* CONFIG::PRODUCTION ONLY */
             } else {
                 if (App::environment('production')) {
                     /* Nothing here */
                 }
             }
         }
     }
 }
开发者ID:neraunzaran,项目名称:fruit-dashboard,代码行数:34,代码来源:DatabaseSeeder.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $currentAppEnvirontment = App::environment();
     // if ($currentAppEnvirontment === 'production') {
     // 	exit('I just stopped you getting fired. Love Phil - Current environment: "' . $currentAppEnvirontment . '"');
     // }
     Eloquent::unguard();
     $truncate = ['user', 'patient', 'identification_type', 'country', 'state', 'city', 'marital_status', 'relationship', 'exam', 'medical_history', 'exam_type', 'exam_item', 'speciality', 'external_cause', 'purpose_appointment', 'cie_category'];
     // se desactivan las relaciones entre las tablas para que el truncado se haga sin problemas.
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     foreach ($truncate as $table) {
         DB::table($table)->truncate();
     }
     // se reactivan las relaciones entre las tablas.
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
     // Se llaman los "seeders" para poblar la db.
     $this->call('UserTableSeeder');
     $this->call('PatientTableSeeder');
     $this->call('CountryTableSeeder');
     $this->call('StateTableSeeder');
     $this->call('CityTableSeeder');
     $this->call('IdentificationTypeTableSeeder');
     $this->call('MaritalStatusTableSeeder');
     $this->call('RelationshipTableSeeder');
     $this->call('ExamTableSeeder');
     $this->call('ExamItemTableSeeder');
     $this->call('medicalHistoryTableSeeder');
     $this->call('ExamTypeTableSeeder');
     $this->call('SpecialityTableSeeder');
     $this->call('ExternalCauseTableSeeder');
     $this->call('PurposeAppointmentTableSeeder');
     $this->call('CieCategoryTableSeeder');
 }
开发者ID:jhoansebastianlara,项目名称:esclinicadigital,代码行数:38,代码来源:DatabaseSeeder.php

示例4: fire

 public function fire()
 {
     if (!$this->input->getOption('force') && \App::environment() === 'production') {
         $this->error('ERROR : use --force to expunge on a production environment');
         die;
     }
     switch (DB::connection()->getDriverName()) {
         case 'mysql':
             $database = DB::connection()->getDatabaseName();
             DB::statement('SET FOREIGN_KEY_CHECKS=0;');
             $expr = DB::raw("SELECT table_name FROM information_schema.tables WHERE table_schema = '{$database}';");
             foreach (DB::select($expr) as $row) {
                 $tables[] = '`' . $row->table_name . '`';
             }
             if (!empty($tables)) {
                 $expr = DB::raw('DROP TABLE IF EXISTS ' . implode(', ', $tables));
                 DB::statement($expr);
             }
             DB::statement('SET FOREIGN_KEY_CHECKS=1;');
             $this->info("Deleted all tables from MySQL database `{$database}`");
             break;
         case 'pgsql':
             $database = DB::connection()->getDatabaseName();
             $result = DB::raw('drop schema public cascade;');
             DB::statement($result);
             $result = DB::raw('create schema public;');
             DB::statement($result);
             $this->info("Deleted all tables from PostgreSQL database `{$database}`");
             break;
     }
 }
开发者ID:rtconner,项目名称:laravel-plusplus,代码行数:31,代码来源:DBExpunge.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     if (App::environment() === 'production') {
         exit('Do not seed in production environment');
     }
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // disable foreign key constraints
     DB::table('users')->truncate();
     DB::table('volunteers')->truncate();
     DB::table('doctors')->truncate();
     User::create(['id' => 1, 'name' => 'admin', 'email' => 'admin@gmail.com', 'password' => '$2y$10$zJxQkCB6UNr9zzLIgve71ekLMEcOWue/lKuyCtunV559qN2NDV1ra', 'roleId' => 2]);
     User::create(['id' => 2, 'name' => 'volunteer1', 'email' => 'volunteer1@gmail.com', 'password' => '$2y$10$zJxQkCB6UNr9zzLIgve71ekLMEcOWue/lKuyCtunV559qN2NDV1ra', 'roleId' => 5]);
     User::create(['id' => 3, 'name' => 'Arun', 'email' => 'doctor1@gmail.com', 'password' => '$2y$10$zJxQkCB6UNr9zzLIgve71ekLMEcOWue/lKuyCtunV559qN2NDV1ra', 'roleId' => 4]);
     User::create(['id' => 4, 'name' => 'Biswas', 'email' => 'doctor2@gmail.com', 'password' => '$2y$10$zJxQkCB6UNr9zzLIgve71ekLMEcOWue/lKuyCtunV559qN2NDV1ra', 'roleId' => 4]);
     User::create(['id' => 5, 'name' => 'Sunil', 'email' => 'doctor3@gmail.com', 'password' => '$2y$10$zJxQkCB6UNr9zzLIgve71ekLMEcOWue/lKuyCtunV559qN2NDV1ra', 'roleId' => 4]);
     User::create(['id' => 6, 'name' => 'volunteer2', 'email' => 'volunteer2@gmail.com', 'password' => '$2y$10$zJxQkCB6UNr9zzLIgve71ekLMEcOWue/lKuyCtunV559qN2NDV1ra', 'roleId' => 5]);
     Volunteer::create(['userId' => 3, 'firstname' => 'volunteer1', 'lastname' => 'volunteer1', 'contactNumber' => '9717017651', 'isVerified' => true]);
     Volunteer::create(['userId' => 6, 'firstname' => 'volunteer2', 'lastname' => 'volunteer2', 'contactNumber' => '9717017650', 'isVerified' => true]);
     Doctor::create(['userId' => 3, 'firstname' => 'Arun', 'lastname' => 'Jain', 'contactNumber' => '9717017650', 'specialization' => 1, 'location' => 'Delhi', 'isVerified' => true]);
     Doctor::create(['userId' => 4, 'firstname' => 'Biswas', 'lastname' => 'Rao', 'contactNumber' => '9717017651', 'specialization' => 2, 'location' => 'Bangalore', 'isVerified' => true]);
     Doctor::create(['userId' => 5, 'firstname' => 'Sunil', 'lastname' => 'Jain', 'contactNumber' => '9717017651', 'specialization' => 2, 'location' => 'Bangalore', 'isVerified' => true]);
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // enable foreign key constraints
 }
开发者ID:CSPRA,项目名称:cspr-web,代码行数:30,代码来源:UserTableSeeder.php

示例6: trackAll

 /**
  * trackAll:
  * --------------------------------------------------
  * Tracks an event with all available tracking sites. In 'lazy mode'
  * eventData contains only the eventName and an eventOption string.
  * In 'detailed mode' the eventData contains all necessary options
  * for all the tracking sites.
  * @param (string)  ($mode)    lazy | detailed
  * @param (array) ($eventData) The event data
  *    LAZY MODE
  *      (string) ($en) The name of the event
  *      (string) ($el) Custom label for the event
  *    DETAILED MODE
  *      (string) (ec) [Req] Event Category (Google)
  *      (string) (ea) [Req] Event Action   (Google)
  *      (string) (el) Event label.         (Google)
  *      (int)    (ev) Event value.         (Google)
  *      (string) (en) [Req] Event name     (Intercom)(Mixpanel)
  *      (array)  (md) Metadata             (Intercom)(Mixpanel)
  * @return None
  * --------------------------------------------------
  */
 public function trackAll($mode, $eventData)
 {
     if (App::environment('production')) {
         /* Lazy mode */
         if ($mode == 'lazy') {
             $googleEventData = array('ec' => $eventData['en'], 'ea' => $eventData['en'], 'el' => $eventData['el']);
             /* Intercom IO event data */
             $intercomEventData = array('en' => $eventData['en'], 'md' => array('metadata' => $eventData['el']));
             /* Mixpanel event data */
             $mixpanelEventData = array('en' => $eventData['en'], 'md' => array('metadata' => $eventData['el']));
             /* Detailed option */
         } else {
             /* Google Analytics event data */
             $googleEventData = array('ec' => $eventData['ec'], 'ea' => $eventData['ea'], 'el' => $eventData['el'], 'ev' => $eventData['ev']);
             /* Intercom IO event data */
             $intercomEventData = array('en' => $eventData['en'], 'md' => $eventData['md']);
             /* Mixpanel event data */
             $mixpanelEventData = array('en' => $eventData['en'], 'md' => $eventData['md']);
         }
         /* Send events */
         self::$google->sendEvent($googleEventData);
         self::$intercom->sendEvent($intercomEventData);
         self::$mixpanel->sendEvent($mixpanelEventData);
     }
 }
开发者ID:neraunzaran,项目名称:fruit-dashboard,代码行数:47,代码来源:GlobalTracker.php

示例7: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (App::environment() == 'testing') {
         Schema::create('lots', function (Blueprint $table) {
             $table->increments('id');
             $table->string('name');
             $table->string('address');
             $table->unsignedInteger('owner_id')->default(0);
             $table->foreign('owner_id')->references('id')->on('owners')->onDelete('cascade');
             $table->decimal('longitude', 12, 8);
             $table->decimal('latitude', 12, 8);
         });
     } else {
         Schema::create('lots', function (Blueprint $table) {
             $table->increments('id');
             $table->string('name');
             $table->string('address');
             $table->unsignedInteger('owner_id')->default(0);
             $table->foreign('owner_id')->references('id')->on('owners')->onDelete('cascade');
             $table->decimal('longitude', 10, 8);
             $table->decimal('latitude', 11, 8);
             $table->timestamps();
         });
     }
 }
开发者ID:kr85,项目名称:SpartaPark,代码行数:30,代码来源:2014_09_11_182432_create_lots_table.php

示例8: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $configFile = $this->env->configFileName();
     if (!File::exists($configFile)) {
         $this->error("\nNo database configuration found.\nPlease create a {$configFile} file in your root directory with your database details.\n-> Alternativly run the `php artisan ssms:dbconfig` helper command.");
     } else {
         $this->line("\nRunning installer script on " . App::environment() . " environment... \n");
         if ($this->confirm("This installer will attempt to create a config file, create & seed database tables. Do you wish to continue? [yes|no]: ")) {
             if (Schema::hasTable('migrations')) {
                 if (!$this->confirm("Previous migrations detected. This installer will reset all tables and settings, are you sure you want to continue? [yes|no] :")) {
                     $this->abort();
                 }
             }
             try {
                 if (!Schema::hasTable('migrations')) {
                     $this->call("migrate:install");
                 }
                 $this->call("migrate:reset");
                 $this->call("migrate");
                 $this->call("db:seed");
                 $this->info("Installer complete!");
             } catch (Exception $e) {
                 $this->error("\nAn error occured during database migrations (code " . $e->getCode() . "): \n   " . $e->getMessage());
                 $this->info("\nCheck your {$configFile} database credentials!");
                 $this->abort();
             }
         } else {
             $this->abort();
         }
     }
 }
开发者ID:Zipcore,项目名称:Sourcemod-Server-Manager-System,代码行数:36,代码来源:InstallCommand.php

示例9: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof ModelNotFoundException) {
         $e = new NotFoundHttpException($e->getMessage(), $e);
     }
     /**
      * Response Exception as Json
      *
      */
     if ($request->wantsJson()) {
         $error = new \stdclass();
         $error->error = true;
         if ($e instanceof NotFoundHttpException) {
             $error->code = $e->getStatusCode();
         } else {
             $error->code = $e->getCode();
         }
         if ($error->code == 0) {
             $error->code = 400;
         }
         if ($e instanceof ValidatorException) {
             $error->message = $e->getMessageBag();
         } else {
             $error->message = $e->getMessage();
             if (\App::environment('local')) {
                 $error->file = $e->getFile();
                 $error->line = $e->getLine();
             }
         }
         return response()->json($error, $error->code);
     }
     return parent::render($request, $e);
 }
开发者ID:adrianodrix,项目名称:codedelivery.dev,代码行数:40,代码来源:Handler.php

示例10: emailAccident

 /**
  * Email Accident
  */
 public function emailAccident()
 {
     $site = Site::findOrFail($this->site_id);
     $email_list = env('EMAIL_ME');
     if (\App::environment('dev', 'prod')) {
         $email_list = "robert@capecod.com.au; gary@capecod.com.au; tara@capecod.com.au; jo@capecod.com.au; " . $email_list;
         foreach ($site->supervisors as $super) {
             if (preg_match(VALID_EMAIL_PATTERN, $super->email)) {
                 $email_list .= '; ' . $super->email;
             }
         }
     }
     $email_list = trim($email_list);
     $email_list = explode(';', $email_list);
     $email_list = array_map('trim', $email_list);
     // trim white spaces
     $email_user = \App::environment('dev', 'prod') ? Auth::user()->email : '';
     $data = ['id' => $this->id, 'site' => $site->name . ' (' . $site->code . ')', 'address' => $site->address . ', ' . $site->SuburbStatePostcode, 'date' => $this->date->format('d/m/Y g:i a'), 'worker' => $this->name . ' (age: ' . $this->age . ')', 'occupation' => $this->occupation, 'location' => $this->location, 'nature' => $this->nature, 'referred' => $this->referred, 'damage' => $this->damage, 'description' => $this->info, 'user_fullname' => User::find($this->created_by)->fullname, 'user_company_name' => User::find($this->created_by)->company->name, 'submit_date' => $this->created_at->format('d/m/Y g:i a'), 'site_owner' => $site->client->clientOfCompany->name];
     Mail::send('emails.siteAccident', $data, function ($m) use($email_list, $email_user) {
         $m->from('do-not-reply@safeworksite.net');
         $m->to($email_list);
         if (preg_match(VALID_EMAIL_PATTERN, $email_user)) {
             $m->cc($email_user);
         }
         $m->subject('WHS Accident Notification');
     });
 }
开发者ID:unclefudge,项目名称:whs,代码行数:30,代码来源:SiteAccident.php

示例11: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if (\App::environment() === 'production') {
         $this->error('This feature is not available on this server');
     }
     $command = base_path('vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'apigen') . ' generate -s app  -d  phpdoc';
     $this->comment($command);
     $process = new Process($command);
     $process->run(function ($type, $buffer) {
         $buffer = trim($buffer);
         if (empty($buffer)) {
             return;
         }
         if ('err' === $type) {
             $this->error($buffer);
         } else {
             $this->comment($buffer);
         }
     });
     if (!$process->isSuccessful()) {
         $this->error($process->getErrorOutput());
         return;
     }
     $this->comment('Documentation generated in folder ' . base_path('phpdoc'));
     $this->comment(\PHP_Timer::resourceUsage());
 }
开发者ID:ndrx-io,项目名称:elude,代码行数:31,代码来源:PhpDocGenerator.php

示例12: layout_version

 function layout_version($layout = 'main')
 {
     $get_hash = function ($layout) {
         $hash = '';
         $files = [public_path('assets/css/app.css'), public_path('assets/js/app.js'), resource_path('views/layouts/main.blade.php'), resource_path('views/partials/header.blade.php'), resource_path('views/partials/footer.blade.php')];
         if ($layout != 'main') {
             $files[] = resource_path('views/layouts/' . str_replace('.', DIRECTORY_SEPARATOR, $layout) . '.blade.php');
         }
         foreach ($files as $file) {
             $hash .= hash_file('md5', $file);
         }
         return hash('md5', $hash);
     };
     if (App::environment('local', 'development', 'staging')) {
         if (!($hash = config('version.layout.' . $layout))) {
             $hash = $get_hash($layout);
             config(compact('hash'));
         }
     } else {
         $hash = Cache::remember('version.layout.' . $layout, config('version.cache_duration', 5), function () use($get_hash, $layout) {
             return $get_hash($layout);
         });
     }
     return $hash;
 }
开发者ID:CupOfTea696,项目名称:CardsAgainstTea,代码行数:25,代码来源:helpers.php

示例13: emailTicket

 /**
  * Email Issue
  */
 public function emailTicket($action)
 {
     $email_list = env('EMAIL_ME');
     if (\App::environment('prod', 'dev')) {
         $email_list = "jo@capecod.com.au; tara@capecod.com.au; " . $email_list;
     }
     $email_list = explode(';', $email_list);
     $email_list = array_map('trim', $email_list);
     // trim white spaces
     $email_user = $this->createdBy->email;
     $data = ['id' => $this->id, 'date' => Carbon::now()->format('d/m/Y g:i a'), 'name' => $this->name, 'priority' => $this->priority_text, 'summary' => $this->summary, 'user_fullname' => Auth::user()->fullname, 'user_company_name' => Auth::user()->company->name];
     $filename = $this->attachment;
     Mail::send('emails/supportTicket', $data, function ($m) use($email_list, $email_user, $filename, $action) {
         $m->from('do-not-reply@safeworksite.net');
         $m->to($email_list);
         if ($email_user) {
             $m->cc($email_user);
         }
         $m->subject('Support Ticket Notification');
         $file_path = public_path('filebank/support/ticket/' . $filename);
         if ($filename && file_exists($file_path)) {
             $m->attach($file_path);
         }
     });
 }
开发者ID:unclefudge,项目名称:whs,代码行数:28,代码来源:SupportTicket.php

示例14: index

 /**
  * Route::get('/', 'HomeController@index');
  *
  * Handle angular application, displaying view based on environment
  */
 public function index()
 {
     if (App::environment() === 'production') {
         return View::make('angularjs.application_production');
     }
     return View::make('angularjs.application');
 }
开发者ID:elartix,项目名称:generator-langular,代码行数:12,代码来源:HomeController.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if (App::environment() == "production") {
         $this->command->error("WARNING: You are running in production. Data will be permanently deleted if you continue.");
         if (!$this->command->confirm('Are you sure you want to continue? [y|n]:', false)) {
             $this->command->comment("Aborting.");
             return;
         }
     }
     $this->call('TruncateTablesSeeder');
     $this->call('PermissionSeeder');
     $this->call('PermissionGroupSeeder');
     $this->call('QualityDefinitionsSeeder');
     $this->call('LiveStreamStateDefinitionsSeeder');
     $this->call('FileExtensionsSeeder');
     $this->call('FileTypesSeeder');
     $this->call('UploadPointsSeeder');
     $this->call('UserSeeder');
     $this->call('SiteUsersSeeder');
     $this->call('LiveStreamsSeeder');
     $this->call('MediaItemSeeder');
     $this->call('FileSeeder');
     $this->call('VideoFilesSeeder');
     $this->call('ShowsSeeder');
     $this->call('PlaylistsSeeder');
     $this->call('ProductionRolesSeeder');
 }
开发者ID:joshhodgson,项目名称:Website,代码行数:32,代码来源:DatabaseSeeder.php


注:本文中的App::environment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。