Skip to content

Commit

Permalink
Merge pull request #8 from kEpEx/allow-custom-app-namespace
Browse files Browse the repository at this point in the history
Allow custom App Namespace
  • Loading branch information
kEpEx authored Sep 24, 2016
2 parents 3a775ea + d966018 commit 43435b6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Console/Commands/CrudGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace CrudGenerator\Console\Commands;

use Illuminate\Container\Container;
use Illuminate\Console\Command;
use DB;
use Artisan;
Expand Down Expand Up @@ -94,7 +95,7 @@ public function handle()
$generator = new \CrudGenerator\CrudGeneratorService();
$generator->output = $this;


$generator->appNamespace = Container::getInstance()->getNamespace();
$generator->modelName = ucfirst($c['modelname']);
$generator->tableName = $c['tablename'];

Expand Down
2 changes: 2 additions & 0 deletions src/CrudGeneratorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class CrudGeneratorService
public $controllerName = '';
public $viewFolderName = '';
public $output = null;
public $appNamespace = 'App';


public function __construct()
Expand Down Expand Up @@ -48,6 +49,7 @@ public function Generate()
'controller_name' => $this->controllerName,
'view_folder' => $this->viewFolderName,
'route_path' => $this->viewFolderName,
'appns' => $this->appNamespace,
];

if(!$this->force) {
Expand Down
8 changes: 4 additions & 4 deletions src/Templates/controller.tpl.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace App\Http\Controllers;
namespace [[appns]]Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use [[appns]]Http\Requests;
use [[appns]]Http\Controllers\Controller;

use App\[[model_uc]];
use [[appns]][[model_uc]];

use DB;

Expand Down

0 comments on commit 43435b6

Please sign in to comment.