Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mlantz committed Jul 25, 2016
1 parent 7bb7a8f commit 3d8347c
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Quarx comes with a module builder for all your custom CMS needs, as well as a mo

1. PHP 5.6+
2. OpenSSL
3. Laravel 5.1+
3. Laravel 5.1 - 5.2 (v1.4.*)

## Installation

Expand Down
49 changes: 43 additions & 6 deletions src/Console/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Config;
use Yab\Laracogs\Traits\FileMakerTrait;

class Setup extends Command
{
use FileMakerTrait;

/**
* The console command name.
*
Expand All @@ -32,7 +35,7 @@ class Setup extends Command
*/
public function fire()
{
$cssReady = $this->confirm('Please confirm that you have gulp fully installed.');
$cssReady = $this->confirm('Please confirm that you have gulp fully installed, and a database set and configured in your .env file.');

if ($cssReady) {
Artisan::call('vendor:publish', [
Expand All @@ -45,9 +48,30 @@ public function fire()
'--force' => true,
]);

$this->line('Are you sure you want to run the setup? (yes/no)');
$fileSystem = new Filesystem();

$files = $fileSystem->allFiles(__DIR__.'/../../../laracogs/src/Packages/Starter');

$this->line('Copying app/Http...');
$this->copyPreparedFiles(__DIR__.'/../../../laracogs/src/Packages/Starter/app/Http', app_path('Http'));

$this->line('Copying app/Repositories...');
$this->copyPreparedFiles(__DIR__.'/../../../laracogs/src/Packages/Starter/app/Repositories', app_path('Repositories'));

$this->line('Copying app/Services...');
$this->copyPreparedFiles(__DIR__.'/../../../laracogs/src/Packages/Starter/app/Services', app_path('Services'));

$this->line('Copying database...');
$this->copyPreparedFiles(__DIR__.'/../../../laracogs/src/Packages/Starter/database', base_path('database'));

$this->line('Copying resources/views...');
$this->copyPreparedFiles(__DIR__.'/../../../laracogs/src/Packages/Starter/resources/views', base_path('resources/views'));

Artisan::call('laracogs:starter');
$this->line('Copying tests...');
$this->copyPreparedFiles(__DIR__.'/../../../laracogs/src/Packages/Starter/tests', base_path('tests'));

$this->line('Appending database/factory...');
$this->createFactory();

$files = [
base_path('database/factories/ModelFactory.php'),
Expand Down Expand Up @@ -189,22 +213,23 @@ public function leaveAllTeams($userId)
}', '', $userService);
file_put_contents(app_path('Services/UserService.php'), $userService);

exec('composer dump');
passthru('composer dump');

$css = file_get_contents(base_path('resources/assets/sass/app.scss'));
$css = str_replace('@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";', '@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";'."\n".'@import "resources/themes/default/assets/sass/_theme.scss";', $css);
file_put_contents(base_path('resources/assets/sass/app.scss'), $css);

exec('gulp');

$composer = file_get_contents(base_path('composer.json'));
$composer = str_replace('"App\\": "app/",', '"App\\": "app/",'."\n".'"Quarx\\": "quarx/",', $composer);
file_put_contents(base_path('composer.json'), $composer);

$this->info('Publishing theme');
Artisan::call('theme:publish', [
'name' => 'default',
'--forced' => true
]);

$this->info('Migrating database');
Artisan::call('migrate:reset', [
'--force' => true,
]);
Expand All @@ -215,6 +240,8 @@ public function leaveAllTeams($userId)
]);

$this->info('Finished setting up your site with Quarx');
$this->info('Please run:');
$this->comment('gulp');
$this->line('You can now login with the following username and password:');
$this->comment('admin@admin.com');
$this->comment('admin');
Expand All @@ -235,4 +262,14 @@ protected function getOptions()
{
return [];
}

public function createFactory()
{
$factory = file_get_contents(__DIR__.'/../../../laracogs/src/Packages/Starter/Factory.txt');
$factoryPrepared = str_replace('{{App\}}', $this->getAppNamespace(), $factory);
$factoryMaster = base_path('database/factories/ModelFactory.php');
file_put_contents($factoryMaster, str_replace($factoryPrepared, '', file_get_contents($factoryMaster)));

return file_put_contents($factoryMaster, $factoryPrepared, FILE_APPEND);
}
}
9 changes: 7 additions & 2 deletions src/Console/ThemePublish.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ThemePublish extends Command
*
* @var string
*/
protected $signature = 'theme:publish {name}';
protected $signature = 'theme:publish {name} {--forced}';

/**
* The console command description.
Expand Down Expand Up @@ -41,7 +41,12 @@ public function handle()
}

$this->info("\n\nThese files will be overwritten\n");
$result = $this->confirm('Are you sure you want to overwrite any files of the same name?');

if (!$this->option('forced')) {
$result = $this->confirm('Are you sure you want to overwrite any files of the same name?');
} else {
$result = true;
}

if ($result) {
foreach ($files as $file) {
Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/BlogRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function allTags()
public function search($input)
{
$query = Blog::orderBy('created_at', 'desc');
$query->where('id', 'LIKE', '%'.$input.'%');
$query->where('id', 'LIKE', '%'.$input['term'].'%');

$columns = Schema::getColumnListing('blogs');

Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/EventRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function published()
public function search($input)
{
$query = Event::orderBy('created_at', 'desc');
$query->where('id', 'LIKE', '%'.$input.'%');
$query->where('id', 'LIKE', '%'.$input['term'].'%');

$columns = Schema::getColumnListing('events');

Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/FAQRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function published()
public function search($input)
{
$query = FAQ::orderBy('created_at', 'desc');
$query->where('id', 'LIKE', '%'.$input.'%');
$query->where('id', 'LIKE', '%'.$input['term'].'%');

$columns = Schema::getColumnListing('faqs');

Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/FileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function paginated()
public function search($input)
{
$query = Files::orderBy('created_at', 'desc');
$query->where('id', 'LIKE', '%'.$input.'%');
$query->where('id', 'LIKE', '%'.$input['term'].'%');

$columns = Schema::getColumnListing('files');

Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/ImagesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function allTags()
public function search($input)
{
$query = Images::orderBy('created_at', 'desc');
$query->where('id', 'LIKE', '%'.$input.'%');
$query->where('id', 'LIKE', '%'.$input['term'].'%');

$columns = Schema::getColumnListing('images');

Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/MenuRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function paginated()
public function search($input)
{
$query = Menu::orderBy('created_at', 'desc');
$query->where('id', 'LIKE', '%'.$input.'%');
$query->where('id', 'LIKE', '%'.$input['term'].'%');

$columns = Schema::getColumnListing('menus');

Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/PagesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function published()
public function search($input)
{
$query = Pages::orderBy('created_at', 'desc');
$query->where('id', 'LIKE', '%'.$input.'%');
$query->where('id', 'LIKE', '%'.$input['term'].'%');

$columns = Schema::getColumnListing('pages');

Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/WidgetsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function paginated()
public function search($input)
{
$query = Widgets::orderBy('created_at', 'desc');
$query->where('id', 'LIKE', '%'.$input.'%');
$query->where('id', 'LIKE', '%'.$input['term'].'%');

$columns = Schema::getColumnListing('widgets');

Expand Down

0 comments on commit 3d8347c

Please sign in to comment.