Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Builders/ControllerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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);
}

}
2 changes: 1 addition & 1 deletion src/Builders/MigrationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
2 changes: 1 addition & 1 deletion src/Builders/ModelBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
6 changes: 3 additions & 3 deletions src/Builders/RequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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]);
}

}
20 changes: 10 additions & 10 deletions src/Builders/ViewsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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$',
Expand Down Expand Up @@ -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$',
Expand Down Expand Up @@ -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]);
}

}
2 changes: 1 addition & 1 deletion src/Cache/QuickCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions src/Commands/QuickAdminInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
26 changes: 13 additions & 13 deletions src/QuickadminServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -41,7 +41,7 @@ public function boot()
'quickadmin:install'
]);
// Routing
include __DIR__ . '/routes.php';
include __DIR__ . DIRECTORY_SEPARATOR .'routes.php';
}

/**
Expand Down