From e3978845d5f6f1e796c588fb6dcfcff9863c7700 Mon Sep 17 00:00:00 2001 From: Luca Fregoso Date: Thu, 26 Nov 2015 18:18:08 +0100 Subject: [PATCH] '/' in paths replaced with DIRECTORY_SEPARATOR --- src/Builders/ControllerBuilder.php | 10 +++++----- src/Builders/MigrationBuilder.php | 2 +- src/Builders/ModelBuilder.php | 2 +- src/Builders/RequestBuilder.php | 6 +++--- src/Builders/ViewsBuilder.php | 20 ++++++++++---------- src/Cache/QuickCache.php | 2 +- src/Commands/QuickAdminInstall.php | 14 +++++++------- src/QuickadminServiceProvider.php | 26 +++++++++++++------------- 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/Builders/ControllerBuilder.php b/src/Builders/ControllerBuilder.php index a3b2697..4d814fb 100644 --- a/src/Builders/ControllerBuilder.php +++ b/src/Builders/ControllerBuilder.php @@ -29,7 +29,7 @@ public function build() { $cache = new QuickCache(); $cached = $cache->get('fieldsinfo'); - $this->template = __DIR__ . '/../Templates/controller'; + $this->template = __DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Templates'. DIRECTORY_SEPARATOR .'controller'; $this->name = $cached['name']; $this->fields = $cached['fields']; $this->relationships = $cached['relationships']; @@ -239,11 +239,11 @@ private function names() */ private function publish($template) { - if (!file_exists(app_path('Http/Controllers/Admin'))) { - mkdir(app_path('Http/Controllers/Admin')); - chmod(app_path('Http/Controllers/Admin'), 0777); + if (!file_exists(app_path('Http'. DIRECTORY_SEPARATOR .'Controllers'. DIRECTORY_SEPARATOR .'Admin'))) { + mkdir(app_path('Http'. DIRECTORY_SEPARATOR .'Controllers'. DIRECTORY_SEPARATOR .'Admin')); + chmod(app_path('Http'. DIRECTORY_SEPARATOR .'Controllers'. DIRECTORY_SEPARATOR .'Admin'), 0777); } - file_put_contents(app_path('Http/Controllers/Admin/' . $this->fileName), $template); + file_put_contents(app_path('Http'. DIRECTORY_SEPARATOR .'Controllers'. DIRECTORY_SEPARATOR .'Admin'. DIRECTORY_SEPARATOR . $this->fileName), $template); } } \ No newline at end of file diff --git a/src/Builders/MigrationBuilder.php b/src/Builders/MigrationBuilder.php index 88cb78b..f30f6bd 100644 --- a/src/Builders/MigrationBuilder.php +++ b/src/Builders/MigrationBuilder.php @@ -25,7 +25,7 @@ public function build() { $cache = new QuickCache(); $cached = $cache->get('fieldsinfo'); - $this->template = __DIR__ . '/../Templates/migration'; + $this->template = __DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Templates'. DIRECTORY_SEPARATOR .'migration'; $this->name = $cached['name']; $this->fields = $cached['fields']; $this->soft = $cached['soft_delete']; diff --git a/src/Builders/ModelBuilder.php b/src/Builders/ModelBuilder.php index 26a61b0..ea78c05 100644 --- a/src/Builders/ModelBuilder.php +++ b/src/Builders/ModelBuilder.php @@ -31,7 +31,7 @@ public function build() { $cache = new QuickCache(); $cached = $cache->get('fieldsinfo'); - $this->template = __DIR__ . '/../Templates/model'; + $this->template = __DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Templates'. DIRECTORY_SEPARATOR .'model'; $this->name = $cached['name']; $this->fields = $cached['fields']; $this->soft = $cached['soft_delete']; diff --git a/src/Builders/RequestBuilder.php b/src/Builders/RequestBuilder.php index 75c6f3c..8d5b8a8 100644 --- a/src/Builders/RequestBuilder.php +++ b/src/Builders/RequestBuilder.php @@ -25,7 +25,7 @@ public function build() { $cache = new QuickCache(); $cached = $cache->get('fieldsinfo'); - $this->template = __DIR__ . '/../Templates/request'; + $this->template = __DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Templates'. DIRECTORY_SEPARATOR .'request'; $this->name = $cached['name']; $this->fields = $cached['fields']; $this->soft = $cached['soft_delete']; @@ -146,8 +146,8 @@ private function names() */ private function publish($template) { - file_put_contents(app_path('Http/Requests/Create' . $this->fileName), $template[0]); - file_put_contents(app_path('Http/Requests/Update' . $this->fileName), $template[1]); + file_put_contents(app_path('Http'. DIRECTORY_SEPARATOR .'Requests'. DIRECTORY_SEPARATOR .'Create' . $this->fileName), $template[0]); + file_put_contents(app_path('Http'. DIRECTORY_SEPARATOR .'Requests'. DIRECTORY_SEPARATOR .'Update' . $this->fileName), $template[1]); } } \ No newline at end of file diff --git a/src/Builders/ViewsBuilder.php b/src/Builders/ViewsBuilder.php index ebb2901..ce1111e 100644 --- a/src/Builders/ViewsBuilder.php +++ b/src/Builders/ViewsBuilder.php @@ -34,9 +34,9 @@ public function build() $cache = new QuickCache(); $cached = $cache->get('fieldsinfo'); $this->template = [ - 0 => __DIR__ . '/../Templates/view_index', - 1 => __DIR__ . '/../Templates/view_edit', - 2 => __DIR__ . '/../Templates/view_create', + 0 => __DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Templates'. DIRECTORY_SEPARATOR .'view_index', + 1 => __DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Templates'. DIRECTORY_SEPARATOR .'view_edit', + 2 => __DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Templates'. DIRECTORY_SEPARATOR .'view_create', ]; $this->name = $cached['name']; $this->fields = $cached['fields']; @@ -162,7 +162,7 @@ private function buildEditForm() if ($field->type == 'relationship') { $label = $field->relationship_name . '_id'; } - $temp = file_get_contents(__DIR__ . '/../Templates/fields/' . $field->type); + $temp = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Templates'. DIRECTORY_SEPARATOR .'fields'. DIRECTORY_SEPARATOR . $field->type); $temp = str_replace([ 'old(\'$LABEL$\')', '$LABEL$', @@ -200,7 +200,7 @@ private function buildCreateForm() if ($field->type == 'relationship') { $key = $field->relationship_name . '_id'; } - $temp = file_get_contents(__DIR__ . '/../Templates/fields/' . $field->type); + $temp = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Templates'. DIRECTORY_SEPARATOR .'fields'. DIRECTORY_SEPARATOR . $field->type); $temp = str_replace([ '$LABEL$', '$TITLE$', @@ -238,12 +238,12 @@ private function names() */ private function publish($template) { - if (!file_exists(base_path('resources/views/admin/' . $this->path))) { - mkdir(base_path('resources/views/admin/' . $this->path)); + if (!file_exists(base_path('resources'. DIRECTORY_SEPARATOR .'views'. DIRECTORY_SEPARATOR .'admin'. DIRECTORY_SEPARATOR . $this->path))) { + mkdir(base_path('resources'. DIRECTORY_SEPARATOR .'views'. DIRECTORY_SEPARATOR .'admin'. DIRECTORY_SEPARATOR . $this->path)); } - file_put_contents(base_path('resources/views/admin/' . $this->path . '/index.blade.php'), $template[0]); - file_put_contents(base_path('resources/views/admin/' . $this->path . '/edit.blade.php'), $template[1]); - file_put_contents(base_path('resources/views/admin/' . $this->path . '/create.blade.php'), $template[2]); + file_put_contents(base_path('resources'. DIRECTORY_SEPARATOR .'views'. DIRECTORY_SEPARATOR .'admin'. DIRECTORY_SEPARATOR . $this->path . DIRECTORY_SEPARATOR .'index.blade.php'), $template[0]); + file_put_contents(base_path('resources'. DIRECTORY_SEPARATOR .'views'. DIRECTORY_SEPARATOR .'admin'. DIRECTORY_SEPARATOR . $this->path . DIRECTORY_SEPARATOR .'edit.blade.php'), $template[1]); + file_put_contents(base_path('resources'. DIRECTORY_SEPARATOR .'views'. DIRECTORY_SEPARATOR .'admin'. DIRECTORY_SEPARATOR . $this->path . DIRECTORY_SEPARATOR .'create.blade.php'), $template[2]); } } \ No newline at end of file diff --git a/src/Cache/QuickCache.php b/src/Cache/QuickCache.php index 48507d8..bb40c7c 100644 --- a/src/Cache/QuickCache.php +++ b/src/Cache/QuickCache.php @@ -11,7 +11,7 @@ class QuickCache public function __construct() { - $this->cacheDir = storage_path('framework/cache/'); + $this->cacheDir = storage_path('framework'. DIRECTORY_SEPARATOR .'cache'. DIRECTORY_SEPARATOR); $this->files = new Filesystem(); if (!file_exists($this->cacheDir)) { mkdir($this->cacheDir); diff --git a/src/Commands/QuickAdminInstall.php b/src/Commands/QuickAdminInstall.php index 55e240d..6e4f3c5 100644 --- a/src/Commands/QuickAdminInstall.php +++ b/src/Commands/QuickAdminInstall.php @@ -54,13 +54,13 @@ public function handle() */ public function copyInitial() { - copy(__DIR__ . '/../Migrations/2015_10_10_000000_create_roles_table', - database_path('migrations/2015_10_10_000000_create_roles_table.php')); - copy(__DIR__ . '/../Migrations/2015_10_10_000000_update_users_table', - database_path('migrations/2015_10_10_000000_update_users_table.php')); - copy(__DIR__ . '/../Migrations/2015_10_10_000000_create_cruds_table', - database_path('migrations/2015_10_10_000000_create_cruds_table.php')); - copy(__DIR__ . '/../Models/publish/User', app_path('User.php')); + copy(__DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Migrations'. DIRECTORY_SEPARATOR .'2015_10_10_000000_create_roles_table', + database_path('migrations'. DIRECTORY_SEPARATOR .'2015_10_10_000000_create_roles_table.php')); + copy(__DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Migrations'. DIRECTORY_SEPARATOR .'2015_10_10_000000_update_users_table', + database_path('migrations'. DIRECTORY_SEPARATOR .'2015_10_10_000000_update_users_table.php')); + copy(__DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Migrations'. DIRECTORY_SEPARATOR .'2015_10_10_000000_create_cruds_table', + database_path('migrations'. DIRECTORY_SEPARATOR .'2015_10_10_000000_create_cruds_table.php')); + copy(__DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR .'Models'. DIRECTORY_SEPARATOR .'publish'. DIRECTORY_SEPARATOR .'User', app_path('User.php')); $this->info('Migrations were transferred successfully'); } diff --git a/src/QuickadminServiceProvider.php b/src/QuickadminServiceProvider.php index f5686c7..7d709f4 100644 --- a/src/QuickadminServiceProvider.php +++ b/src/QuickadminServiceProvider.php @@ -17,20 +17,20 @@ class QuickadminServiceProvider extends ServiceProvider public function boot() { // Register vendor views - $this->loadViewsFrom(__DIR__ . '/Views/qa', 'qa'); - $this->loadViewsFrom(__DIR__ . '/Views/templates', 'tpl'); + $this->loadViewsFrom(__DIR__ . DIRECTORY_SEPARATOR . 'Views'. DIRECTORY_SEPARATOR .'qa', 'qa'); + $this->loadViewsFrom(__DIR__ . DIRECTORY_SEPARATOR . 'Views'. DIRECTORY_SEPARATOR .'templates', 'tpl'); /* Publish master templates */ $this->publishes([ - __DIR__ . '/Config/quickadmin.php' => config_path('quickadmin.php'), - __DIR__ . '/Views/admin' => base_path('resources/views/admin'), - __DIR__ . '/Views/auth' => base_path('resources/views/auth'), - __DIR__ . '/Views/emails' => base_path('resources/views/emails'), - __DIR__ . '/Public/quickadmin' => base_path('public/quickadmin'), - __DIR__ . '/Controllers/publish/UsersController' => app_path('Http/Controllers/UsersController.php'), - __DIR__ . '/Controllers/publish/Controller' => app_path('Http/Controllers/Controller.php'), - __DIR__ . '/Controllers/publish/PasswordController' => app_path('Http/Controllers/Auth/PasswordController.php'), - __DIR__ . '/Controllers/publish/FileUploadTrait' => app_path('Http/Controllers/Traits/FileUploadTrait.php'), - __DIR__ . '/Models/publish/Role' => app_path('Role.php'), + __DIR__ . DIRECTORY_SEPARATOR . 'Config'. DIRECTORY_SEPARATOR .'quickadmin.php' => config_path('quickadmin.php'), + __DIR__ . DIRECTORY_SEPARATOR . 'Views'. DIRECTORY_SEPARATOR .'admin' => base_path('resources'. DIRECTORY_SEPARATOR .'views'. DIRECTORY_SEPARATOR .'admin'), + __DIR__ . DIRECTORY_SEPARATOR . 'Views'. DIRECTORY_SEPARATOR .'auth' => base_path('resources'. DIRECTORY_SEPARATOR .'views'. DIRECTORY_SEPARATOR .'auth'), + __DIR__ . DIRECTORY_SEPARATOR . 'Views'. DIRECTORY_SEPARATOR .'emails' => base_path('resources'. DIRECTORY_SEPARATOR .'views'. DIRECTORY_SEPARATOR .'emails'), + __DIR__ . DIRECTORY_SEPARATOR . 'Public'. DIRECTORY_SEPARATOR .'quickadmin' => base_path('public'. DIRECTORY_SEPARATOR .'quickadmin'), + __DIR__ . DIRECTORY_SEPARATOR . 'Controllers'. DIRECTORY_SEPARATOR .'publish'. DIRECTORY_SEPARATOR .'UsersController' => app_path('Http'. DIRECTORY_SEPARATOR .'Controllers'. DIRECTORY_SEPARATOR .'UsersController.php'), + __DIR__ . DIRECTORY_SEPARATOR . 'Controllers'. DIRECTORY_SEPARATOR .'publish'. DIRECTORY_SEPARATOR .'Controller' => app_path('Http'. DIRECTORY_SEPARATOR .'Controllers'. DIRECTORY_SEPARATOR .'Controller.php'), + __DIR__ . DIRECTORY_SEPARATOR . 'Controllers'. DIRECTORY_SEPARATOR .'publish'. DIRECTORY_SEPARATOR .'PasswordController' => app_path('Http'. DIRECTORY_SEPARATOR .'Controllers'. DIRECTORY_SEPARATOR .'Auth'. DIRECTORY_SEPARATOR .'PasswordController.php'), + __DIR__ . DIRECTORY_SEPARATOR . 'Controllers'. DIRECTORY_SEPARATOR .'publish'. DIRECTORY_SEPARATOR .'FileUploadTrait' => app_path('Http'. DIRECTORY_SEPARATOR .'Controllers'. DIRECTORY_SEPARATOR .'Traits'. DIRECTORY_SEPARATOR .'FileUploadTrait.php'), + __DIR__ . DIRECTORY_SEPARATOR . 'Models'. DIRECTORY_SEPARATOR .'publish'. DIRECTORY_SEPARATOR .'Role' => app_path('Role.php'), ], 'quickadmin'); // Register commands @@ -41,7 +41,7 @@ public function boot() 'quickadmin:install' ]); // Routing - include __DIR__ . '/routes.php'; + include __DIR__ . DIRECTORY_SEPARATOR .'routes.php'; } /**