/** * 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'); } }
/** * Inserts the access log information in * the database * * @param array $alogs Access Log lines * @param $fromServer array The sender of these access logs * * @throws \Kassner\LogParser\FormatException */ public function insertAccessLogging(array $alogs, $fromServer, $parseString) { try { if (!(count($alogs) > 0)) { return; } $parser = new \Kassner\LogParser\LogParser(); $parser->setFormat($parseString); $toBeInserted = []; foreach ($alogs as $line) { $userSpec = $parser->parse($line); if ($userSpec->host === '::1') { continue; } $userSpec->device = parse_user_agent($userSpec->HeaderUserAgent); $city = new Reader(database_path() . '/GeoLite2-City.mmdb'); $geoRecord = $city->city($userSpec->host); $userSpec->fromServer = $fromServer; $userSpec->location = ['city' => $geoRecord->city->name, 'country' => $geoRecord->country->name]; $userSpec->createdAt = time(); $toBeInserted[] = $userSpec; } $this->mongoCollectionForAccess->batchInsert($toBeInserted); } catch (\Exception $e) { error_log(print_r($e, true)); } }
/** * @param PackageBase $package */ protected function cripBoot(PackageBase $package) { $this->package = $package; // init package translations if ($package->enable_translations) { $this->loadTranslationsFrom($package->path . '/resources/lang', $package->name); } // init package views if ($package->enable_views) { $this->loadViewsFrom($package->path . '/resources/views', $package->name); $this->publish[$package->path . '/resources/views'] = base_path('resources/views/vendor/' . $package->name); } // init router (should be initialised after loadViewsFrom if is using views) if (!$this->app->routesAreCached() && $package->enable_routes) { require $package->path . '/App/Routes.php'; } if ($package->publish_public) { $this->publish[$package->path . '/public'] = $package->public_path; } if ($package->publish_database) { $this->publish[$package->path . '/database/migrations'] = database_path('migrations'); } if (count($this->publish)) { $this->publishes($this->publish); } if ($package->publish_config) { $this->publishes([$package->path . '/config/' . $package->config_name . '.php' => config_path($package->name . '.php')], 'config'); } }
public function boot() { $this->loadViewsFrom(__DIR__ . '/Resources/views', 'RofilContent'); $this->publishes([__DIR__ . '/database/migrations' => database_path("migrations")], "migrations"); $this->publishes([__DIR__ . '/public' => public_path("rofil-content")], "public"); $this->publishes([__DIR__ . '/config/menu-admin-content.php' => config_path("menu-admin-content.php")], 'config'); }
public function boot(Application $app) { $source = realpath(__DIR__ . '/migrations/'); if ($app->runningInConsole()) { $this->publishes([$source => database_path('migrations')], 'migrations'); } }
/** * Publish Footprints migration */ protected function publishMigration() { $published_migration = glob(database_path('/migrations/*_create_footprints_table.php')); if (count($published_migration) === 0) { $this->publishes([__DIR__ . '/database/migrations/migrations.stub' => database_path('/migrations/' . date('Y_m_d_His') . '_create_footprints_table.php')], 'migrations'); } }
/** * Bootstrap the application services. * * @return void */ public function boot() { //Publishes package config file to applications config folder $this->publishes([__DIR__ . '/config/Multibanco.php' => config_path('Multibanco.php')], 'config'); //Publishes package migration files to applications databas/migrations folder $this->publishes([__DIR__ . '/database/migrations/' => database_path('migrations')], 'migrations'); }
/** * Execute the console command. * * @return mixed */ public function fire() { if (!$this->confirmToProceed()) { return; } $this->prepareDatabase(); // The pretend option can be used for "simulating" the migration and grabbing // the SQL queries that would fire if the migration were to be run against // a database for real, which is helpful for double checking migrations. $pretend = $this->input->getOption('pretend'); $opts = ["pretend" => $pretend]; $path = database_path(config('smart-seeder.seedDir')); $env = $this->option('env'); $this->migrator->setEnv($env); $single = $this->option('file'); if ($single) { $this->migrator->runSingleFile("{$path}/{$single}", $pretend); } else { $this->migrator->run($path, $opts); } // Once the migrator has run we will grab the note output and send it out to // the console screen, since the migrator itself functions without having // any instances of the OutputInterface contract passed into the class. foreach ($this->migrator->getNotes() as $note) { $this->output->writeln($note); } }
/** * Perform post-registration booting of services. * * @return void */ public function boot() { if (!$this->app->routesAreCached()) { require __DIR__ . '/Http/routes.php'; } $configFiles = ['job']; foreach ($configFiles as $config) { $this->mergeConfigFrom(__DIR__ . "/config/{$config}.php", 'job_market_manager'); } $this->loadTranslationsFrom(__DIR__ . '/resources/lang', 'job_market_manager'); $this->loadViewsFrom(__DIR__ . '/resources/views', 'job_market_manager'); //Publish middleware // $this->publishes([ // __DIR__ . '/Middleware/' => app_path('Http/Middleware'), // ]); //Publish providers // $this->publishes([ // __DIR__ . '/Providers/' => app_path('Providers'), // ]); //Publish views $this->publishes([__DIR__ . '/resources/views' => resource_path('views')], 'views'); //Publish translations $this->publishes([__DIR__ . '/resources/lang/' => resource_path('lang/')], 'translations'); // Publish a config file $this->publishes([__DIR__ . '/config/job.php' => config_path('job.php')], 'config'); //Publish migrations $this->publishes([__DIR__ . '/database/migrations' => database_path('migrations')], 'migrations'); // $this->publishes([ // __DIR__.'/assets/bower_components/AdminLTE/' => public_path('/assets/bower_components/AdminLTE/'), // ], 'public'); $this->publishes([__DIR__ . '/Http/Controllers/Admin/' => app_path('/Http/Controllers/Admin/')], 'controllers'); $this->publishes([__DIR__ . '/Models/Admin/' => app_path()], 'models'); }
/** * Bootstrap any application services. * * @return void */ public function boot() { $this->publishes([__DIR__ . '/../config/shows.php/' => config_path('shows.php')], 'config'); $this->publishes([__DIR__ . '/../database/migrations/' => database_path('migrations')], 'migrations'); $this->loadViewsFrom(__DIR__ . '/../resources/views', 'shows'); $this->publishes([__DIR__ . '/../resources/views' => resource_path('views/vendor/shows')]); }
/** * Perform post-registration booting of services. * * @return void */ public function boot() { if (!$this->app->routesAreCached()) { require __DIR__ . '/routes.php'; } $this->app->make('designpond\\newsletter\\Http\\Controllers\\Frontend\\NewsletterController'); $this->app->make('designpond\\newsletter\\Http\\Controllers\\Frontend\\InscriptionController'); $this->app->make('designpond\\newsletter\\Http\\Controllers\\Backend\\NewsletterController'); $this->app->make('designpond\\newsletter\\Http\\Controllers\\Backend\\CampagneController'); $this->app->make('designpond\\newsletter\\Http\\Controllers\\Backend\\ContentController'); $this->app->make('designpond\\newsletter\\Http\\Controllers\\Backend\\SendController'); $this->app->make('designpond\\newsletter\\Http\\Controllers\\Backend\\SubscriberController'); $this->app->make('designpond\\newsletter\\Http\\Controllers\\Backend\\ImportController'); $this->app->make('designpond\\newsletter\\Http\\Controllers\\Backend\\ListController'); $this->app->make('designpond\\newsletter\\Http\\Controllers\\Backend\\EmailController'); $this->app->make('designpond\\newsletter\\Http\\Controllers\\Backend\\ClipboardController'); $this->publishes([__DIR__ . '/database/migrations/' => database_path('migrations')], 'migrations'); $this->publishes([__DIR__ . '/database/seeds' => base_path('database/seeds')], 'seeds'); $this->publishes([__DIR__ . '/config/newsletter.php' => config_path('newsletter.php')], 'config'); $this->publishes([__DIR__ . '/assets' => public_path('newsletter')], 'assets'); $this->loadViewsFrom(__DIR__ . '/views', 'newsletter'); $this->publishes([__DIR__ . '/views' => resource_path('views/vendor/newsletter')], 'views'); $this->publishes([__DIR__ . '/views/Backend/layouts' => resource_path('views/vendor/newsletter/Backend/layouts')], 'layouts'); $this->app['validator']->extend('emailconfirmed', function ($attribute, $value, $parameters) { $email = \DB::table('newsletter_users')->where('email', '=', $value)->first(); if ($email) { return !$email->activated_at ? false : true; } return false; }); }
public function run() { // Uncomment the below to wipe the table clean before populating DB::table('user_info')->delete(); $faker = Faker\Factory::create('fr_FR'); $faker->addProvider(new Faker\Provider\fr_FR\Address($faker)); //if we want to create the SAME seed generated data every time we run, instead of //making file, just use the Faker->seed() call: $faker->seed(1234); $infos[] = ['iduser_info' => 1, 'info_lieu' => 'Nantes', 'info_gps' => $faker->latitude . ',' . $faker->longitude, 'info_poste' => 'Directeur Artistique', 'info_promo' => 1995, 'info_promo_type' => 'L']; $metiers = file(database_path() . "/seeds/metiers.csv"); $work_list = array('Étudiant', 'Poète', 'Programmeur', 'Entrepreneur', 'Commercial', 'Barman', 'Serveur', 'Œnologue'); $serie_list = array('ES', 'L', 'S'); //now, make our data array: for ($i = 0; $i < 30; $i++) { $key_work = array_rand($work_list); $key_serie = array_rand($serie_list); //$json = 'http://api.randomuser.me/'; //$jsonfile = file_get_contents($json); $info = array('iduser_info' => null, 'info_lieu' => $faker->city, 'info_gps' => $faker->latitude . ',' . $faker->longitude, 'info_poste' => ucwords(strtolower(explode('=', $metiers[array_rand($metiers)])[1])), 'info_promo' => $faker->year, 'info_promo_type' => $serie_list[$key_serie]); $infos[] = $info; } //// Uncomment the below to run the seeder DB::table('user_info')->insert($infos); }
/** * Bootstrap the application services. * * @return void */ public function boot() { // The publication files to publish $this->publishes([__DIR__ . '/config/config.php' => config_path('countries.php')]); $this->publishes([__DIR__ . '/database/Seeders/' => database_path('seeds')], 'seeders'); $this->publishes([__DIR__ . '/database/migrations/' => database_path('migrations')], 'migrations'); }
/** * Perform post-registration booting of services. * * @return void */ public function boot() { $this->loadViewsFrom(realpath(__DIR__ . '/views'), 'faq'); $this->setupRoutes(); // this for conig $this->publishes([__DIR__ . '/config/faq.php' => config_path('faq.php'), __DIR__ . '/database/migrations' => database_path('migrations'), __DIR__ . '/database/seeds' => database_path('seeds')]); }
protected function publishMigration() { $published_migration = glob(database_path('/migrations/*_create_crazy_tables.php')); if (count($published_migration) === 0) { $this->publishes([__DIR__ . '/../database/migrations/2016_06_09_175930_create_crazy_tables.php' => database_path('/migrations/' . date('Y_m_d_His') . '_create_crazy_tables.php')], 'migrations'); } }
public function boot() { // $this->publishes([ // __DIR__.'/../config/package.php' => config_path('package.php') // ], 'config'); $this->publishes([__DIR__ . '/../database/migrations/' => database_path('migrations')], 'migrations'); }
/** * Bootstrap the application events. * * @return void */ public function boot() { // set root $dir = __DIR__ . '/../../../'; // publish migrations $this->publishes([$dir . 'migrations' => database_path('migrations')], 'migrations'); }
/** * Execute the console command. * * @return mixed */ public function fire() { $model = ucfirst($this->argument('model')); $path = $this->option('path'); if (empty($path)) { $path = database_path(config('smart-seeder.seedDir')); } else { $path = base_path($path); } $env = $this->option('env'); if (!empty($env)) { $path .= "/{$env}"; } if (!$this->files->exists($path)) { // mode 0755 is based on the default mode Laravel use. $this->files->makeDirectory($path, 755, true); } $created = date('Y_m_d_His'); $path .= "/seed_{$created}_{$model}Seeder.php"; $fs = $this->files->get(__DIR__ . '/stubs/DatabaseSeeder.stub'); $namespace = rtrim($this->getAppNamespace(), '\\'); $stub = str_replace('{{seeder}}', "seed_{$created}_" . $model . 'Seeder', $fs); $stub = str_replace('{{namespace}}', " namespace {$namespace};", $stub); $stub = str_replace('{{model}}', $model, $stub); $this->files->put($path, $stub); $message = "Seed created for {$model}"; if (!empty($env)) { $message .= " in environment: {$env}"; } $this->line($message); }
/** * {@inheritDoc} */ public function boot() { // Setup Default namespace until config file is published. if (!($namespace = config('laraflock.dashboard.viewNamespace'))) { $namespace = 'dashboard'; } // Load & Publish views. $this->loadViewsFrom(__DIR__ . '/../Resources/views', $namespace); $this->publishes([__DIR__ . '/../Resources/views' => base_path('resources/views/vendor/' . $namespace)], 'views'); // Load translations. $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'dashboard'); // Use package routes. if (config('laraflock.dashboard.routes')) { include __DIR__ . '/../routes.php'; } // Publish config. $config = realpath(__DIR__ . '/../config.php'); $this->mergeConfigFrom($config, 'laraflock.dashboard'); $this->publishes([$config => config_path('laraflock.dashboard.php')], 'config'); // Publish migrations. $migrations = realpath(__DIR__ . '/../Database/Migrations'); $this->publishes([$migrations => database_path('/migrations')], 'migrations'); // Publish assets. $this->publishes([__DIR__ . '/../Resources/assets' => public_path('vendor/laraflock')], 'public'); // Setup interfaces. $this->setupInterfaces(); }
/** * Bootstrap the application events. */ public function boot() { $this->publishes([__DIR__ . '/../config/laravel-geo.php' => config_path('laravel-geo.php')], 'config'); $this->publishes([__DIR__ . '/../database/migrations/' => database_path('migrations')], 'migrations'); $this->publishes([__DIR__ . '/../public/js/' => public_path('vendor/roem')], 'public'); $this->publishes([__DIR__ . '/../resources/js/' => resource_path('assets/vendor/roem/laravel-geo')], 'resources'); }
/** * Perform post-registration booting of services. * * @return void */ public function boot() { if (!$this->app->routesAreCached()) { require __DIR__ . '/Http/routes.php'; } $this->publishes([__DIR__ . '/database/migrations/' => database_path('migrations')], 'migrations'); }
public function boot() { /* * Set configuration variables */ $this->mergeConfigFrom(__DIR__ . '/../../config/multi-tenant.php', 'multi-tenant'); /* * Publish migrations */ $this->publishes([__DIR__ . '/../../migrations/' => database_path('/migrations')], 'migrations'); /* * Bind tenancy into container */ new TenancyEnvironment($this->app); /* * Register middleware to detect hostname and redirect if required */ $this->app->make('Illuminate\\Contracts\\Http\\Kernel')->prependMiddleware('HynMe\\MultiTenant\\Middleware\\HostnameMiddleware'); /* * Model observers */ $this->observers(); /* * Bind setup command into ioc */ $this->app->bind(SetupCommand::class, function ($app) { return new SetupCommand($app->make('HynMe\\MultiTenant\\Contracts\\HostnameRepositoryContract'), $app->make('HynMe\\MultiTenant\\Contracts\\WebsiteRepositoryContract'), $app->make('HynMe\\MultiTenant\\Contracts\\TenantRepositoryContract')); }); /* * Register commands */ $this->commands([SetupCommand::class]); }
/** * Bootstrap the application events. * * @return void */ public function boot() { $this->loadViewsFrom(__DIR__ . '/views', 'maven'); $this->publishes([__DIR__ . '/migrations' => database_path('migrations')], 'migrations'); $this->loadTranslationsFrom(__DIR__ . 'translations', 'maven'); $this->publishes([__DIR__ . '/translations' => base_path('resources/lang/vendor/maven')], 'translations'); }
/** * Boot the service provider * * @return void */ public function boot() { $this->publishes([__DIR__ . '/assets/config.php' => config_path('rooles.php')], 'config'); $this->publishes([__DIR__ . '/assets/views/403.blade.php' => base_path('resources/views/errors/403.blade.php')], 'views'); $this->publishes([__DIR__ . '/assets/migration.php' => database_path('migrations/' . date('Y_m_d_His_') . 'add_role_column_to_user_table.php')], 'migrations'); $this->mergeConfigFrom(__DIR__ . '/assets/config.php', 'rooles'); }
public function boot() { /*Assets , CKEDITOR*/ $this->publishes([__DIR__ . '/../assets/' => public_path('drauta/bloglaravel')], 'public'); /*Migrations*/ $this->publishes([__DIR__ . '/../database/migrations/' => database_path('migrations')], 'migrations'); }
/** * Boot the service provider. */ public function boot() { if (!$this->app->environment('production')) { $this->publishes([__DIR__ . '/resources/config.php' => config_path('chronicle.php')], 'config'); $this->publishes([__DIR__ . '/database/migrations/' => database_path('/migrations')], 'migrations'); } }
/** * Publish migration */ protected function publishMigration() { $published_migration = glob(database_path('/migrations/*_captain_hook_setup_table.php')); if (count($published_migration) === 0) { $this->publishes([__DIR__ . '/../../database/2015_10_29_000000_captain_hook_setup_table.php' => database_path('/migrations/' . date('Y_m_d_His') . '_captain_hook_setup_table.php')], 'migrations'); } }
public function register() { $this->publishes([__DIR__ . '/../database/seeds/' => database_path('seeds')], 'seeds'); $this->publishes([__DIR__ . '/../database/migrations/' => database_path('migrations')], 'migrations'); $this->publishes([__DIR__ . '/../app/' => app_path()], 'app'); $this->publishes([__DIR__ . '/../resources/views/' => resource_path('views')], 'views'); }
/** * Bootstrap the application events. * * @return void */ public function boot() { global $enabled, $consumer_key, $consumer_secret, $currency, $controller, $key, $redirectTo, $email, $mail, $name; // $this->package('ericmuigai/pesapal'); $this->publishes([__DIR__ . '/../../config/config.php' => config_path('pesapal.php')], 'config'); $this->publishes([__DIR__ . '/../../migrations/' => database_path('migrations')], 'migrations'); $this->loadViewsFrom(__DIR__ . '/../../views', 'pesapal'); include __DIR__ . '/../../routes.php'; $app = $this->app; // Config $this->mergeConfigFrom(__DIR__ . '/../../config/config.php', 'pesapal'); $enabled = config('pesapal.enabled'); $consumer_key = config('pesapal.consumer_key'); $consumer_secret = config('pesapal.consumer_secret'); $currency = config('pesapal.currency'); $controller = config('pesapal.controller'); $key = config('pesapal.currency'); $redirectTo = config('pesapal.redirectTo'); $email = config('pesapal.email'); $mail = config('pesapal.mail'); $name = config('pesapal.name'); $this->app['pesapal'] = $this->app->share(function ($app) { return new Pesapal($app['view']); }); }
/** * Perform post-registration booting of services. * * @return void */ public function boot() { $this->loadViewsFrom(realpath(__DIR__ . '/../views'), 'entrance'); $this->setupRoutes($this->app->router); // this for conig $this->publishes([__DIR__ . '/config/entrance.php' => config_path('entrance.php'), __DIR__ . '/database/migrations' => database_path('migrations'), __DIR__ . '/database/seeds' => database_path('seeds'), __DIR__ . '/models' => app_path(), __DIR__ . '/views/emails' => base_path('resources/views/intothesource/entrance/emails'), __DIR__ . '/views/pages' => base_path('resources/views/intothesource/entrance/pages'), __DIR__ . '/Http/Controllers' => app_path('Http/Controllers/Intothesource/Entrance')]); }