Skip to content

Commit fbbc2d3

Browse files
author
Riari
committed
Correct post route
Also cleans up a majority of files to format them consistently
1 parent 67dd871 commit fbbc2d3

File tree

15 files changed

+760
-756
lines changed

15 files changed

+760
-756
lines changed

src/Riari/Forum/Commands/InstallCommand.php

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,49 @@
44

55
class InstallCommand extends Command {
66

7-
protected $name = 'forum:install';
8-
protected $description = 'Create default forum controllers.';
9-
10-
public function fire()
11-
{
12-
$this->info('Fetching controller names from integration config...');
13-
$controller = class_basename(\Config::get('forum::integration.controller'));
14-
15-
$this->info('Config specifies controllers: "'.$controller.'"');
16-
if (!$this->confirm('Proceed with controller creation (no override)? [Yes|no]'))
17-
{
18-
$this->info('Action aborted. No changes done.');
19-
return;
20-
}
21-
22-
$this->installController($controller, '\Riari\Forum\Controllers\BaseController');
23-
24-
$this->info('Forum installation done.');
25-
}
26-
27-
private function installController($name, $parent)
28-
{
29-
$file = $this->laravel->path.'/controllers/'.$name.'.php';
30-
if(file_exists($file))
31-
{
32-
$this->info('File app/controllers/'.$name.' Exists. Action aborted.');
33-
return;
34-
}
35-
36-
file_put_contents($file, $this->getControllerContent($name, $parent));
37-
$this->info('File app/controllers/'.$name.' Created');
38-
}
39-
40-
public function getControllerContent($name, $parent)
41-
{
42-
$content = "<?php\n"
43-
."/* Autogenerated Forum Controller */\n"
44-
."/* Hook point of the Forum package inside your laravel application */\n"
45-
."/* Feel free to override methods here to fit your requirements */\n"
46-
."class %s extends %s {\n\n"
47-
."}\n";
48-
49-
return sprintf($content, $name, $parent);
50-
}
7+
protected $name = 'forum:install';
8+
protected $description = 'Create default forum controllers.';
9+
10+
public function fire()
11+
{
12+
$this->info('Fetching controller names from integration config...');
13+
$controller = class_basename(\Config::get('forum::integration.controller'));
14+
15+
$this->info('Config specifies controllers: "'.$controller.'"');
16+
if (!$this->confirm('Proceed with controller creation (no override)? [Yes|no]'))
17+
{
18+
$this->info('Action aborted. No changes done.');
19+
return;
20+
}
21+
22+
$this->installController($controller, '\Riari\Forum\Controllers\BaseController');
23+
24+
$this->info('Forum installation done.');
25+
}
26+
27+
private function installController($name, $parent)
28+
{
29+
$file = $this->laravel->path.'/controllers/'.$name.'.php';
30+
if(file_exists($file))
31+
{
32+
$this->info('File app/controllers/'.$name.' Exists. Action aborted.');
33+
return;
34+
}
35+
36+
file_put_contents($file, $this->getControllerContent($name, $parent));
37+
$this->info('File app/controllers/'.$name.' Created');
38+
}
39+
40+
public function getControllerContent($name, $parent)
41+
{
42+
$content = "<?php\n"
43+
."/* Autogenerated Forum Controller */\n"
44+
."/* Hook point of the Forum package inside your laravel application */\n"
45+
."/* Feel free to override methods here to fit your requirements */\n"
46+
."class %s extends %s {\n\n"
47+
."}\n";
48+
49+
return sprintf($content, $name, $parent);
50+
}
5151

5252
}

0 commit comments

Comments
 (0)