@@ -49,7 +49,7 @@ |
||
| 49 | 49 | foreach($tasks as $task) |
| 50 | 50 | { |
| 51 | 51 | app($task)->setConsole($this) |
| 52 | - ->handle(); |
|
| 52 | + ->handle(); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $this->info('You strong bear. You finished setup. Be wise and remember to:'); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | // Domain::class, no domain classes for the time being |
| 47 | 47 | ]; |
| 48 | 48 | |
| 49 | - foreach($tasks as $task) |
|
| 49 | + foreach ($tasks as $task) |
|
| 50 | 50 | { |
| 51 | 51 | app($task)->setConsole($this) |
| 52 | 52 | ->handle(); |
@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $project = $this->ask('Projectname (required)'); |
| 64 | 64 | $client = $this->ask('Client (required)'); |
| 65 | - $url = $this->ask('Site url','https://'.Str::slug($project).'.be'); |
|
| 66 | - $namespace = $this->ask('Namespace',Str::slug($project)); |
|
| 65 | + $url = $this->ask('Site url', 'https://'.Str::slug($project).'.be'); |
|
| 66 | + $namespace = $this->ask('Namespace', Str::slug($project)); |
|
| 67 | 67 | |
| 68 | 68 | (new ChiefConfig()) |
| 69 | - ->set('mtime',filemtime(base_path('server.php'))) |
|
| 70 | - ->set('project',$project) |
|
| 71 | - ->set('client',$client) |
|
| 72 | - ->set('url',$url) |
|
| 73 | - ->set('namespace',$namespace); |
|
| 69 | + ->set('mtime', filemtime(base_path('server.php'))) |
|
| 70 | + ->set('project', $project) |
|
| 71 | + ->set('client', $client) |
|
| 72 | + ->set('url', $url) |
|
| 73 | + ->set('namespace', $namespace); |
|
| 74 | 74 | } |
| 75 | 75 | } |
@@ -13,19 +13,19 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function get($key) |
| 15 | 15 | { |
| 16 | - if(isset(self::$attributes[$key])) return self::$attributes[$key]; |
|
| 16 | + if (isset(self::$attributes[$key])) return self::$attributes[$key]; |
|
| 17 | 17 | |
| 18 | 18 | return null; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function set($key,$value) |
|
| 21 | + public function set($key, $value) |
|
| 22 | 22 | { |
| 23 | 23 | self::$attributes[$key] = $value; |
| 24 | 24 | |
| 25 | 25 | return $this; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public static function __callStatic($method,$arg) |
|
| 28 | + public static function __callStatic($method, $arg) |
|
| 29 | 29 | { |
| 30 | 30 | return (new self)->get($method); |
| 31 | 31 | } |
@@ -13,7 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function get($key) |
| 15 | 15 | { |
| 16 | - if(isset(self::$attributes[$key])) return self::$attributes[$key]; |
|
| 16 | + if(isset(self::$attributes[$key])) { |
|
| 17 | + return self::$attributes[$key]; |
|
| 18 | + } |
|
| 17 | 19 | |
| 18 | 20 | return null; |
| 19 | 21 | } |
@@ -12,12 +12,12 @@ |
||
| 12 | 12 | { |
| 13 | 13 | $setupProjectConfigFile = true; |
| 14 | 14 | |
| 15 | - if(file_exists(base_path('config/project.php')) && filemtime(base_path('config/project.php')) > ChiefConfig::mtime()) |
|
| 15 | + if (file_exists(base_path('config/project.php')) && filemtime(base_path('config/project.php')) > ChiefConfig::mtime()) |
|
| 16 | 16 | { |
| 17 | 17 | $setupProjectConfigFile = $this->console->confirm('/confirm/project.php file has been altered. Do you wish to override it with a fresh one?', false); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if($setupProjectConfigFile) |
|
| 20 | + if ($setupProjectConfigFile) |
|
| 21 | 21 | { |
| 22 | 22 | $this->copyWithParameters( |
| 23 | 23 | base_path('app/Console/Chief/default/project.php'), |
@@ -10,16 +10,16 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | public function handle() |
| 12 | 12 | { |
| 13 | - collect(['.env','.env.production','.env.staging'])->each(function($filename){ |
|
| 13 | + collect(['.env', '.env.production', '.env.staging'])->each(function($filename) { |
|
| 14 | 14 | $this->copyEnvironmentFile($filename); |
| 15 | 15 | }); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | private function copyEnvironmentFile($filename) |
| 19 | 19 | { |
| 20 | - if(!file_exists(base_path($filename))) |
|
| 20 | + if (!file_exists(base_path($filename))) |
|
| 21 | 21 | { |
| 22 | - echo exec('cp .env.example ' . $filename); |
|
| 22 | + echo exec('cp .env.example '.$filename); |
|
| 23 | 23 | $this->setApplicationKeyInEnvironmentFile($filename); |
| 24 | 24 | $this->setEnvironmentFlag($filename); |
| 25 | 25 | $this->setDebugFlag($filename); |
@@ -36,36 +36,36 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | $newvalue = ($filename == '.env') ? 'true' : 'false'; |
| 38 | 38 | |
| 39 | - $this->changeValue($filename,'APP_DEBUG',$newvalue); |
|
| 39 | + $this->changeValue($filename, 'APP_DEBUG', $newvalue); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | private function setEnvironmentFlag($filename) |
| 43 | 43 | { |
| 44 | 44 | // Environment is taken from last part of string |
| 45 | - $environment = substr($filename,strrpos($filename,'.')+1); |
|
| 46 | - if($environment == 'env') $environment = 'local'; |
|
| 45 | + $environment = substr($filename, strrpos($filename, '.')+1); |
|
| 46 | + if ($environment == 'env') $environment = 'local'; |
|
| 47 | 47 | |
| 48 | - $this->changeValue($filename,'APP_ENV',$environment); |
|
| 48 | + $this->changeValue($filename, 'APP_ENV', $environment); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | private function setUrl($filename) |
| 52 | 52 | { |
| 53 | - $environment = substr($filename,strrpos($filename,'.')+1); |
|
| 54 | - if($environment == 'env') return; |
|
| 55 | - if($environment == 'production') $url = ChiefConfig::url(); |
|
| 56 | - if($environment == 'staging') $url = ChiefConfig::project().'.thinktomorrow.be'; |
|
| 53 | + $environment = substr($filename, strrpos($filename, '.')+1); |
|
| 54 | + if ($environment == 'env') return; |
|
| 55 | + if ($environment == 'production') $url = ChiefConfig::url(); |
|
| 56 | + if ($environment == 'staging') $url = ChiefConfig::project().'.thinktomorrow.be'; |
|
| 57 | 57 | |
| 58 | - $this->changeValue($filename,'APP_URL',$url); |
|
| 58 | + $this->changeValue($filename, 'APP_URL', $url); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | private function setApplicationKeyInEnvironmentFile($filename) |
| 62 | 62 | { |
| 63 | - $this->changeValue($filename,'APP_KEY',$this->generateRandomKey()); |
|
| 63 | + $this->changeValue($filename, 'APP_KEY', $this->generateRandomKey()); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - private function changeValue($filename,$key,$value) |
|
| 66 | + private function changeValue($filename, $key, $value) |
|
| 67 | 67 | { |
| 68 | - $content = preg_replace('#'.$key.'=[^\\n]*#',$key.'='.$value, file_get_contents(base_path($filename))); |
|
| 68 | + $content = preg_replace('#'.$key.'=[^\\n]*#', $key.'='.$value, file_get_contents(base_path($filename))); |
|
| 69 | 69 | |
| 70 | 70 | file_put_contents(base_path($filename), $content); |
| 71 | 71 | } |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | $this->setDebugFlag($filename); |
| 26 | 26 | $this->setUrl($filename); |
| 27 | 27 | $this->console->comment('Creating ['.$filename.'] environment file with new application key'); |
| 28 | - } |
|
| 29 | - else |
|
| 28 | + } else |
|
| 30 | 29 | { |
| 31 | 30 | $this->console->comment('Environment file ['.$filename.'] already exists. You should delete this manually first.'); |
| 32 | 31 | } |
@@ -43,7 +42,9 @@ discard block |
||
| 43 | 42 | { |
| 44 | 43 | // Environment is taken from last part of string |
| 45 | 44 | $environment = substr($filename,strrpos($filename,'.')+1); |
| 46 | - if($environment == 'env') $environment = 'local'; |
|
| 45 | + if($environment == 'env') { |
|
| 46 | + $environment = 'local'; |
|
| 47 | + } |
|
| 47 | 48 | |
| 48 | 49 | $this->changeValue($filename,'APP_ENV',$environment); |
| 49 | 50 | } |
@@ -51,9 +52,15 @@ discard block |
||
| 51 | 52 | private function setUrl($filename) |
| 52 | 53 | { |
| 53 | 54 | $environment = substr($filename,strrpos($filename,'.')+1); |
| 54 | - if($environment == 'env') return; |
|
| 55 | - if($environment == 'production') $url = ChiefConfig::url(); |
|
| 56 | - if($environment == 'staging') $url = ChiefConfig::project().'.thinktomorrow.be'; |
|
| 55 | + if($environment == 'env') { |
|
| 56 | + return; |
|
| 57 | + } |
|
| 58 | + if($environment == 'production') { |
|
| 59 | + $url = ChiefConfig::url(); |
|
| 60 | + } |
|
| 61 | + if($environment == 'staging') { |
|
| 62 | + $url = ChiefConfig::project().'.thinktomorrow.be'; |
|
| 63 | + } |
|
| 57 | 64 | |
| 58 | 65 | $this->changeValue($filename,'APP_URL',$url); |
| 59 | 66 | } |
@@ -12,12 +12,12 @@ |
||
| 12 | 12 | { |
| 13 | 13 | $setupComposerFile = true; |
| 14 | 14 | |
| 15 | - if(file_exists(base_path('composer.json')) && filemtime(base_path('composer.json')) > ChiefConfig::mtime()) |
|
| 15 | + if (file_exists(base_path('composer.json')) && filemtime(base_path('composer.json')) > ChiefConfig::mtime()) |
|
| 16 | 16 | { |
| 17 | 17 | $setupComposerFile = $this->console->confirm('Composer.json file has been altered. Do you wish to override it with a fresh one?', false); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if($setupComposerFile) |
|
| 20 | + if ($setupComposerFile) |
|
| 21 | 21 | { |
| 22 | 22 | $this->copyWithParameters( |
| 23 | 23 | base_path('app/Console/Chief/default/composer.json'), |
@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | $copyDomainClasses = true; |
| 13 | 13 | |
| 14 | - if(is_dir(base_path('src'))) |
|
| 14 | + if (is_dir(base_path('src'))) |
|
| 15 | 15 | { |
| 16 | 16 | $copyDomainClasses = $this->console->confirm('/src directory already exists? Are you sure you want to refresh it?', false); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - if($copyDomainClasses) |
|
| 19 | + if ($copyDomainClasses) |
|
| 20 | 20 | { |
| 21 | 21 | $this->safeCopy(__DIR__.'/../default/src'); |
| 22 | 22 | } |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $copyDir = true; |
| 40 | 40 | |
| 41 | - if(is_dir(base_path('src/'.$entry))) |
|
| 41 | + if (is_dir(base_path('src/'.$entry))) |
|
| 42 | 42 | { |
| 43 | 43 | $copyDir = $this->console->confirm('/src/'.$entry.' directory already exists? Overwrite it?', false); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if($copyDir) |
|
| 46 | + if ($copyDir) |
|
| 47 | 47 | { |
| 48 | - $this->recursiveCopy($dir.'/'.$entry,base_path('src/'.$entry)); |
|
| 48 | + $this->recursiveCopy($dir.'/'.$entry, base_path('src/'.$entry)); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -53,23 +53,23 @@ discard block |
||
| 53 | 53 | closedir($handle); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - protected function recursiveCopy($src,$dst) { |
|
| 56 | + protected function recursiveCopy($src, $dst) { |
|
| 57 | 57 | $dir = opendir($src); |
| 58 | 58 | |
| 59 | - if(!is_dir($dst)) |
|
| 59 | + if (!is_dir($dst)) |
|
| 60 | 60 | { |
| 61 | - mkdir($dst,0777,true); |
|
| 61 | + mkdir($dst, 0777, true); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - while(false !== ( $file = readdir($dir)) ) { |
|
| 65 | - if (( $file != '.' ) && ( $file != '..' )) { |
|
| 66 | - if ( is_dir($src . '/' . $file) ) { |
|
| 67 | - $this->recursiveCopy($src . '/' . $file,$dst . '/' . $file); |
|
| 64 | + while (false !== ($file = readdir($dir))) { |
|
| 65 | + if (($file != '.') && ($file != '..')) { |
|
| 66 | + if (is_dir($src.'/'.$file)) { |
|
| 67 | + $this->recursiveCopy($src.'/'.$file, $dst.'/'.$file); |
|
| 68 | 68 | } |
| 69 | 69 | else { |
| 70 | 70 | $this->copyWithParameters( |
| 71 | - $src . '/' . $file, |
|
| 72 | - $dst . '/' . $file |
|
| 71 | + $src.'/'.$file, |
|
| 72 | + $dst.'/'.$file |
|
| 73 | 73 | ); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -65,8 +65,7 @@ |
||
| 65 | 65 | if (( $file != '.' ) && ( $file != '..' )) { |
| 66 | 66 | if ( is_dir($src . '/' . $file) ) { |
| 67 | 67 | $this->recursiveCopy($src . '/' . $file,$dst . '/' . $file); |
| 68 | - } |
|
| 69 | - else { |
|
| 68 | + } else { |
|
| 70 | 69 | $this->copyWithParameters( |
| 71 | 70 | $src . '/' . $file, |
| 72 | 71 | $dst . '/' . $file |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * Contact email which will recieve all incoming communication |
| 7 | 7 | * This contact will receive e.g. contactform submissions |
| 8 | 8 | */ |
| 9 | - 'contact' => ['email' => env('MAIL_ADMIN_EMAIL','[email protected]'), 'name' => env('MAIL_ADMIN_NAME','Think Tomorrow')], |
|
| 9 | + 'contact' => ['email' => env('MAIL_ADMIN_EMAIL', '[email protected]'), 'name' => env('MAIL_ADMIN_NAME', 'Think Tomorrow')], |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Name of the project |
@@ -11,17 +11,17 @@ |
||
| 11 | 11 | { |
| 12 | 12 | $anticipations = $this->getAnticipations(); |
| 13 | 13 | |
| 14 | - $firstname = $this->anticipate('firstname',array_pluck($anticipations,'firstname')); |
|
| 14 | + $firstname = $this->anticipate('firstname', array_pluck($anticipations, 'firstname')); |
|
| 15 | 15 | $anticipatedLastname = null; |
| 16 | - $lastname = $this->anticipate('lastname',array_pluck($anticipations,'lastname'),$anticipatedLastname); |
|
| 16 | + $lastname = $this->anticipate('lastname', array_pluck($anticipations, 'lastname'), $anticipatedLastname); |
|
| 17 | 17 | |
| 18 | - $email = $this->ask('email',str_slug($firstname).'@thinktomorrow.be'); |
|
| 18 | + $email = $this->ask('email', str_slug($firstname).'@thinktomorrow.be'); |
|
| 19 | 19 | |
| 20 | 20 | $password = $this->askPassword(); |
| 21 | 21 | |
| 22 | 22 | $this->createUser($firstname, $lastname, $email, $password); |
| 23 | 23 | |
| 24 | - $this->info($firstname.' '.$lastname. ' succesfully added as admin user.'); |
|
| 24 | + $this->info($firstname.' '.$lastname.' succesfully added as admin user.'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -14,12 +14,12 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public function handle() |
| 16 | 16 | { |
| 17 | - if(app()->environment() != 'local' && !$this->option('force')) |
|
| 17 | + if (app()->environment() != 'local' && !$this->option('force')) |
|
| 18 | 18 | { |
| 19 | 19 | throw new \Exception('Aborting. This command is dangerous and only meant for your local environment.'); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - if(app()->environment() != 'local' && $this->option('force')) |
|
| 22 | + if (app()->environment() != 'local' && $this->option('force')) |
|
| 23 | 23 | { |
| 24 | 24 | if (!$this->confirm('You are about to force refresh the database in the '.app()->environment().' environment! ARE YOU SURE?')) { |
| 25 | 25 | $this->info('aborting.'); |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if($this->option('force')){ |
|
| 35 | + if ($this->option('force')) { |
|
| 36 | 36 | $this->call('migrate:fresh', ['--force' => true]); |
| 37 | - }else{ |
|
| 37 | + }else { |
|
| 38 | 38 | $this->call('migrate:fresh'); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | private function settingPermissionsAndRoles() |
| 52 | 52 | { |
| 53 | - AuthorizationDefaults::permissions()->each(function($permissionName){ |
|
| 53 | + AuthorizationDefaults::permissions()->each(function($permissionName) { |
|
| 54 | 54 | Artisan::call('chief:permission', ['name' => $permissionName]); |
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | - AuthorizationDefaults::roles()->each(function($defaultPermissions, $roleName){ |
|
| 58 | - Artisan::call('chief:role', ['name' => $roleName, '--permissions' => implode(',',$defaultPermissions)]); |
|
| 57 | + AuthorizationDefaults::roles()->each(function($defaultPermissions, $roleName) { |
|
| 58 | + Artisan::call('chief:role', ['name' => $roleName, '--permissions' => implode(',', $defaultPermissions)]); |
|
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | 61 | $this->info('Default permissions and roles'); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ['Json', 'Voorhees', '[email protected]', $password], |
| 80 | 80 | ]); |
| 81 | 81 | |
| 82 | - $admins->each(function($admin){ |
|
| 82 | + $admins->each(function($admin) { |
|
| 83 | 83 | $this->createUser($admin[0], $admin[1], $admin[2], $admin[3], 'developer'); |
| 84 | 84 | $this->info('Added '.$admin[0].' as developer role with your provided password.'); |
| 85 | 85 | }); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | |
| 35 | 35 | if($this->option('force')){ |
| 36 | 36 | $this->call('migrate:fresh', ['--force' => true]); |
| 37 | - }else{ |
|
| 37 | + } else{ |
|
| 38 | 38 | $this->call('migrate:fresh'); |
| 39 | 39 | } |
| 40 | 40 | |