コード例 #1
1
ファイル: Easyrouting.php プロジェクト: avnir/easyrouting
 public static function run()
 {
     foreach (glob(app_path() . '/Http/Controllers/*.php') as $filename) {
         $file_parts = explode('/', $filename);
         $file = array_pop($file_parts);
         $file = rtrim($file, '.php');
         if ($file == 'Controller') {
             continue;
         }
         $controllerName = 'App\\Http\\Controllers\\' . $file;
         $controller = new $controllerName();
         if (isset($controller->exclude) && $controller->exclude === true) {
             continue;
         }
         $methods = [];
         $reflector = new \ReflectionClass($controller);
         foreach ($reflector->getMethods(\ReflectionMethod::IS_PUBLIC) as $rMethod) {
             // check whether method is explicitly defined in this class
             if ($rMethod->getDeclaringClass()->getName() == $reflector->getName()) {
                 $methods[] = $rMethod->getName();
             }
         }
         \Route::resource(strtolower(str_replace('Controller', '', $file)), $file, ['only' => $methods]);
     }
 }
コード例 #2
0
 public function exists()
 {
     if (file_exists(app_path() . '/events/' . $this->name . '.php')) {
         return true;
     }
     return false;
 }
コード例 #3
0
 public function make($resource)
 {
     $controllerName = $this->getControllerName($resource);
     $path = app_path() . "/controllers/{$controllerName}.php";
     $template = $this->getTemplate($resource);
     $this->file->put($path, $template);
 }
コード例 #4
0
 /**
  * @test
  */
 public function publish_rules_file_creates_rules_file()
 {
     $this->assertFileNotExists(app_path('Settings/Resources/Rules.php'));
     Artisan::call('pbag:rules');
     $this->assertFileExists(app_path('Settings/Resources/Rules.php'));
     File::deleteDirectory(app_path('Settings'));
 }
コード例 #5
0
 /**
  * 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');
 }
コード例 #6
0
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/custom_routes.php');
         require app_path('Http/routes.php');
     });
 }
コード例 #7
0
ファイル: MigrateCommand.php プロジェクト: huycao/yoplatform
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $parentFolder = app_path('database/migrations');
     $allFolder = scandir($parentFolder);
     $_fileService = new Filesystem();
     $_tmpPath = app_path('storage') . DIRECTORY_SEPARATOR . 'migrations';
     if (!is_dir($_tmpPath) && !$_fileService->exists($_tmpPath)) {
         $_fileService->mkdir($_tmpPath);
     }
     $this->info("Gathering migration files to {$_tmpPath}");
     if (!empty($allFolder)) {
         $_fileService->remove($_tmpPath);
         foreach ($allFolder as $folder) {
             if (is_dir($parentFolder . '/' . $folder) && $folder != '.' && $folder != '..') {
                 $_fileService->mirror($parentFolder . '/' . $folder, $_tmpPath);
             }
         }
         $this->info("Migrating...");
         $this->call('migrate', array('--path' => ltrim(str_replace(base_path(), '', $_tmpPath), '/')));
         // Delete all temp migration files
         $this->info("Cleaning temporary files");
         $_fileService->remove($_tmpPath);
         // Done
         $this->info("DONE!");
     }
 }
コード例 #8
0
 /**
  * Run paths migrations
  *
  * @return void
  */
 protected function runPathsMigration()
 {
     $_fileService = new Filesystem();
     $_tmpPath = app_path('storage') . DIRECTORY_SEPARATOR . 'migrations';
     if (!is_dir($_tmpPath) && !$_fileService->exists($_tmpPath)) {
         $_fileService->mkdir($_tmpPath);
     }
     $this->info("Gathering migration files to {$_tmpPath}");
     // Copy all files to storage/migrations
     foreach ($this->migrationList as $migration) {
         $_fileService->mirror($migration['path'], $_tmpPath);
     }
     //call migrate command on temporary path
     $this->info("Migrating...");
     $opts = array('--path' => ltrim(str_replace(base_path(), '', $_tmpPath), '/'));
     if ($this->input->getOption('force')) {
         $opts['--force'] = true;
     }
     if ($this->input->getOption('database')) {
         $opts['--database'] = $this->input->getOption('database');
     }
     $this->call('migrate', $opts);
     // Delete all temp migration files
     $this->info("Cleaning temporary files");
     $_fileService->remove($_tmpPath);
     // Done
     $this->info("DONE!");
 }
コード例 #9
0
 public function __construct($commandData)
 {
     $this->commandData = $commandData;
     $this->path = Config::get('generator.path_routes', app_path('Http/routes.php'));
     $this->apiPath = Config::get('generator.path_api_routes', app_path('Http/api_routes.php'));
     $this->useDingo = Config::get('generator.use_dingo_api', false);
 }
コード例 #10
0
 protected function GenerateController()
 {
     $this->console->line('Generating Controller: ' . $this->controllerName);
     $controller = \View::file(__DIR__ . '/Templates/controller.blade.php', $this->templateData)->render();
     $path = app_path() . '/Http/Controllers/' . $this->controllerName . '.php';
     file_put_contents($path, $controller);
 }
コード例 #11
0
 public function generateFile()
 {
     $command = 'generate:migration';
     $table = $this->mb->getTable();
     $new = array();
     $fields = array();
     foreach ($this->mb->getColumns() as $name => $column) {
         if (!Schema::hasColumn($table, $name)) {
             $new[] = $name;
             $format = sprintf('%s:%s', $name, $column->getType());
             if ($column->isNullable()) {
                 $format .= ':nullable';
             }
             $fields[] = $format;
         }
     }
     if (Schema::hasTable($table)) {
         $name = sprintf('add_%s_to_%s_table', implode('_', $new), Str::snake($table));
         if (!$fields) {
             return;
         }
     } else {
         $name = sprintf('create_%s_table', Str::snake($table));
     }
     $file = ucwords($name) . '.php';
     $path = app_path() . '/database/migrations' . '/' . $file;
     $fields = implode(', ', $fields);
     $created = $this->parse($name, $fields)->make($path, null);
 }
コード例 #12
0
 function __construct($commandData)
 {
     $this->commandData = $commandData;
     $this->path = Config::get('generator.path_routes', app_path('Http/routes.php'));
     $this->apiPrefix = Config::get('generator.api_prefix', 'api');
     $this->apiNamespace = Config::get('generator.namespace_api_controller', 'App\\Http\\Controllers\\API');
 }
 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');
 }
コード例 #14
0
 /**
  * 配置 API 路由.
  */
 public function configureAPIRoute()
 {
     $api_router = app('Dingo\\Api\\Routing\\Router');
     $api_router->group(['version' => env('API_PREFIX'), 'namespace' => $this->api_namespace], function ($router) {
         require app_path('Http/api_routes.php');
     });
 }
コード例 #15
0
ファイル: StationString.php プロジェクト: elroyK/hyperRail
 /**
  * Converts a station id to a station string. If the string cannot be converted,
  * null is returned.
  * @param $string
  * @return string or null
  */
 public static function convertToString($string)
 {
     // Fetch stations list to compare the station string with
     $json = \File::get(app_path() . "/stations.json");
     $data = json_decode($json);
     // For each station in the array of stations, attempt comparison
     foreach ($data->{"@graph"} as $station) {
         /*
          * TODO: write an array with station name alternates
          *
          * This also solves multilanguage issues since the strings are simply converted
          * to the proper id :) This way, we can make iRail multilanguage!
          *
          * $alternates = array(
          * "Gent-Sint-Pieters" => array('Ghent-Sint-Pieters', 'Gent Sint Pieters', 'Ghent Sint Pieters')
          * )
          */
         /*
          * Assuming we have a list of station name alternates, we can do even more
          * comparisons to ensure that this process is functional.
          * TODO: write a function that loops through station name alternates
          */
         /* If we can find the station name in the string of Nicola's records,
          * we can return the station data if we get a hit!
          * Arguably we need to check if there are multiple hits:
          * TODO: check for multiple hits when using strpos()
          */
         if (strpos($station->{"@id"}, $string) !== false) {
             return $station;
         }
     }
     return null;
 }
コード例 #16
0
ファイル: View.php プロジェクト: nicebro/wf-test-task
 function __construct()
 {
     $this->locale = app()->config()->get('locale');
     $this->session = app()->session();
     $this->session->flash(['inputs' => app()->request()->inputs]);
     $this->translations = (include app_path() . '/lang/' . app()->config()->get('locale') . '/main.php');
 }
コード例 #17
0
ファイル: ModuleBuilder.php プロジェクト: ratno/Doptor
 function __construct()
 {
     $this->templatePath = app_path() . '/Services/module_template/';
     $this->selected_forms = array();
     $this->form_rendered = '';
     $this->nav_tabs = '';
 }
コード例 #18
0
 private function getModelNames()
 {
     $path = app_path() . "/Models";
     $out = array();
     if (getenv('DEFAULT_MODEL')) {
         $out["default"] = getenv('DEFAULT_MODEL');
     }
     if (file_exists($path)) {
         $results = scandir($path);
         foreach ($results as $result) {
             if ($result === '.' or $result === '..' or $result[0] === '.') {
                 continue;
             }
             $filename = $result;
             if (is_dir($filename)) {
                 $out = array_merge($out, getModelNames($fileName));
             } else {
                 $out[] = substr($filename, 0, -4);
             }
         }
         return $out;
     } else {
         return false;
     }
 }
コード例 #19
0
 /**
  * @param $file
  * @param $projectName
  * @param $path
  */
 public function copyFile($file, $projectName, $path)
 {
     $path = app_path();
     $base = base_path();
     echo $path . '/Util/' . $file . " - " . public_path();
     File::copy($path . '/Util/app.php', '/home/paulo/Projetos/TesteSC/config/app.php');
 }
コード例 #20
0
 /**
  * Define the "web" routes for the application.
  *
  * These routes all receive session state, CSRF protection, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 protected function mapWebRoutes(Router $router)
 {
     $router->group(['namespace' => $this->namespace, 'middleware' => 'web'], function ($router) {
         require app_path('Http/api_routes.php');
         require app_path('Http/routes.php');
     });
 }
コード例 #21
0
 public function boot()
 {
     if (!$this->files->exists(app_path() . '/Modules/')) {
         mkdir(app_path() . '/Modules/');
     }
     $modules = config("modules.list") ?: array_map('class_basename', $this->files->directories(app_path() . '/Modules/'));
     foreach ($modules as $module) {
         $routes = app_path() . '/Modules/' . $module . '/Http/routes.php';
         $views = app_path() . '/Modules/' . $module . '/Views';
         $trans = app_path() . '/Modules/' . $module . '/Translations';
         if ($this->files->exists($routes)) {
             include $routes;
         }
         if ($this->files->isDirectory($views)) {
             $this->loadViewsFrom($views, $module);
         }
         if ($this->files->isDirectory($trans)) {
             $this->loadTranslationsFrom($trans, $module);
         }
         //load multiple config files inside config folder
         $config_files = array_map('class_basename', $this->files->files(app_path() . '/Modules/' . $module . '/config/'));
         foreach ($config_files as $config_file) {
             $fname = basename($config_file, ".php");
             $this->mergeConfigFrom(app_path() . '/Modules/' . $module . '/config/' . $config_file, 'mod-' . $fname);
         }
     }
 }
コード例 #22
0
 /**
  * Handle the event
  * @param LoginEvent $event
  * @return int
  */
 public function handle(LoginEvent $event)
 {
     //$data = $event->broadcastWith();
     $user = $event->_user;
     //debug($user);
     $status = $event->_status ? 0 : 1;
     $re = array('status' => $status);
     //debug('in LoginEvent the LoginEventListen handle method');
     /*$pathToFile = 'F:\wamp\www\test.php';
             $image = 'F:\wamp\www\123.jpg';
             $theme = 'Theme'.rand(1000,1000000);
             $data = ['username'=>$user->username,'email'=>'*****@*****.**','image'=>$image];
             $mail = Mail::send('email.remind', ['user' => $data], function ($m) use ($data,$pathToFile,$theme) {
                 $m->from(env('MAIL_USERNAME'), 'Application');
     
                 $m->to($data['email'], $data['username'])->subject($theme);
     
                 //$m->attach($pathToFile);
             });
     
     
     
             return  $mail;*/
     file_put_contents(app_path() . '/queue.txt', time() . '"\\n"', FILE_APPEND);
     return 'success';
 }
コード例 #23
0
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function ($router) {
         /** @noinspection PhpIncludeInspection */
         require app_path('Http/routes.php');
     });
 }
コード例 #24
0
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     //
     foreach (glob(app_path() . '/Helpers/*.php') as $filename) {
         require_once $filename;
     }
 }
コード例 #25
0
ファイル: ScaffoldCommand.php プロジェクト: devchd/metronic
 public function saveFiles()
 {
     file_put_contents(base_path() . "/database/migrations/" . date("Y_m_d_His") . "_create_table_" . Str::lower($this->plural_name) . "_table.php", $this->migration_template);
     file_put_contents(base_path() . "/database/seeds/" . Str::title($this->plural_name) . "Seeder.php", $this->seed_template);
     if (!file_exists(app_path() . "/Models")) {
         mkdir(app_path() . "/Models");
     }
     file_put_contents(app_path() . "/Models/" . Str::title($this->model_name) . ".php", $this->model_template);
     file_put_contents(app_path() . "/Http/Controllers/" . Str::title($this->plural_name) . "Controller" . ".php", $this->controller_template);
     if (!file_exists(base_path() . "/resources/lang/en")) {
         mkdir(base_path() . "/resources/lang/en");
     }
     if (!file_exists(base_path() . "/resources/lang/es")) {
         mkdir(base_path() . "/resources/lang/es");
     }
     file_put_contents(base_path() . "/resources/lang/en/" . Str::lower($this->plural_name) . ".php", $this->lang_template);
     file_put_contents(base_path() . "/resources/lang/es/" . Str::lower($this->plural_name) . ".php", $this->lang_template);
     file_put_contents(app_path() . "/Http/routes.php", $this->route_template, FILE_APPEND);
     if (!file_exists(base_path() . "/resources/views/" . ($this->prefix != "" ? $this->prefix : ""))) {
         mkdir(base_path() . "/resources/views/" . ($this->prefix != "" ? $this->prefix : ""));
     }
     if (!file_exists(base_path() . "/resources/views/" . ($this->prefix != "" ? $this->prefix . "/" : "") . Str::lower($this->plural_name))) {
         mkdir(base_path() . "/resources/views/" . ($this->prefix != "" ? $this->prefix . "/" : "") . Str::lower($this->plural_name));
     }
     file_put_contents(base_path() . "/resources/views/" . ($this->prefix != "" ? $this->prefix . "/" : "") . Str::lower($this->plural_name) . "/index.blade.php", $this->index_template);
     file_put_contents(base_path() . "/resources/views/" . ($this->prefix != "" ? $this->prefix . "/" : "") . Str::lower($this->plural_name) . "/new.blade.php", $this->new_template);
     file_put_contents(base_path() . "/resources/views/" . ($this->prefix != "" ? $this->prefix . "/" : "") . Str::lower($this->plural_name) . "/edit.blade.php", $this->edit_template);
     $src = __DIR__ . "/../layout";
     $dest = base_path() . "/resources/views/" . ($this->prefix != "" ? $this->prefix . "/" : "");
     shell_exec("cp -r {$src} {$dest}");
 }
コード例 #26
0
 public function sectionTitle(Request $request)
 {
     $input = $request->input();
     $template = view()->file(app_path('Http/Templates/section-title.blade.php'), $request->input());
     Session::flash('data', $input);
     return view('items.show')->with(['template' => $template]);
 }
コード例 #27
0
 public function run()
 {
     DB::table('mst_countries')->truncate();
     $country_name_full = array();
     $country_name_file = app_path() . "/country_name_new.txt";
     $myfile_country_name = fopen($country_name_file, "r") or die("Unable to open file!");
     $read_country_name_file = fread($myfile_country_name, filesize($country_name_file));
     $array_country_names = explode("\n", $read_country_name_file);
     foreach ($array_country_names as $key_country_names) {
         if ($key_country_names != null) {
             $country_name_list = explode(" ", $key_country_names);
             $country_name_full[$country_name_list[0]] = $country_name_list[1];
         }
     }
     $country_name_ja = "";
     $file_folder = public_path() . "/flags/";
     //use the directory class
     $files = dir($file_folder);
     //read all files ;from the  directory
     chdir($file_folder);
     $file_names = glob('*.png');
     $i = 1;
     //$c = 1;
     foreach ($file_names as $file_name) {
         $country_name_en = explode('.', $file_name, -1);
         if (!empty($country_name_full[$country_name_en[0]])) {
             $country_name_ja = $country_name_full[$country_name_en[0]];
         }
         $country = array("country_name" => $country_name_en[0], "flag_url" => "flags/" . $file_name, "country_name_ja" => $country_name_ja);
         Country::create($country);
         $i++;
         echo $i . "\n";
     }
     closedir($files->handle);
 }
コード例 #28
-1
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     // Find path to the package
     $sentinelFilename = with(new \ReflectionClass('\\Sentinel\\SentinelServiceProvider'))->getFileName();
     $sentinelPath = dirname($sentinelFilename);
     // Load the package
     $this->package('rydurham/sentinel');
     // Register the Sentry Service Provider
     $this->app->register('Cartalyst\\Sentry\\SentryServiceProvider');
     // Add the Views Namespace
     if (is_dir(app_path() . '/views/packages/rydurham/sentinel')) {
         // The package views have been published - use those views.
         $this->app['view']->addNamespace('Sentinel', array(app_path() . '/views/packages/rydurham/sentinel'));
     } else {
         // The package views have not been published. Use the defaults.
         $this->app['view']->addNamespace('Sentinel', __DIR__ . '/../views');
     }
     // Add the Sentinel Namespace to $app['config']
     if (is_dir(app_path() . '/config/packages/rydurham/sentinel')) {
         // The package config has been published
         $this->app['config']->addNamespace('Sentinel', app_path() . '/config/packages/rydurham/sentinel');
     } else {
         // The package config has not been published.
         $this->app['config']->addNamespace('Sentinel', __DIR__ . '/../config');
     }
     // Add the Translator Namespace
     $this->app['translator']->addNamespace('Sentinel', __DIR__ . '/../lang');
     // Make the app aware of these files
     include $sentinelPath . '/../routes.php';
     include $sentinelPath . '/../filters.php';
     include $sentinelPath . '/../observables.php';
     include $sentinelPath . '/../composers.php';
     include $sentinelPath . '/../validators.php';
 }
コード例 #29
-1
 /**
  * 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')]);
 }
コード例 #30
-1
 public function updated($recipient_email, $recipient_name, $data, $use_mailchimp = false, $send_mail = true)
 {
     $subject = "Ticket #" . $data['ticket_id'] . " , Status - " . $data['ticket_status_txt'] . " , Your ticket have been updated . Please login to dashboard to view";
     if ($use_mailchimp) {
         $view = 'emails.tickets.mailchimp_view';
     } else {
         $settings = json_decode(\Settings::where('key', 'mailchimp')->pluck('value'));
         if ($settings->use_mailchimp) {
             $paired = \PairedTemplates::where('view', 'emails.tickets.ticket_updated')->first();
             if (!empty($paired)) {
                 $template = $this->mailchimp->getTemplate($paired->template_id);
                 $file_path = app_path() . "/views/emails/users/mailchimp_view.blade.php";
                 \File::put($file_path, $template['preview']);
                 $view = 'emails.users.mailchimp_view';
             } else {
                 $view = 'emails.tickets.ticket_updated';
             }
         } else {
             $view = 'emails.tickets.ticket_updated';
         }
     }
     if ($send_mail) {
         $this->sendTo($recipient_email, $recipient_name, $subject, $view, $data);
     } else {
         return $data;
     }
 }