Skip to content

Commit

Permalink
Adding the correct version
Browse files Browse the repository at this point in the history
  • Loading branch information
tnylea-tcg committed Mar 30, 2020
1 parent 7258866 commit 40fce3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Models/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ class Theme extends Model
protected $fillable = ['name', 'folder', 'version'];

public function options(){
return $this->hasMany('\DevDojo\Themes\Models\ThemeOptions', 'theme_id');
return $this->hasMany('\Themes\Models\ThemeOptions', 'theme_id');
}
}
9 changes: 4 additions & 5 deletions src/ThemesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class ThemesServiceProvider extends ServiceProvider
*/
public function register()
{
dd('hit');
if (request()->is(config('voyager.prefix')) || request()->is(config('voyager.prefix').'/*')) {
$this->addThemesTable();

Expand Down Expand Up @@ -63,10 +62,10 @@ public function boot()

if (Schema::hasTable('themes')) {
$theme = $this->rescue(function () {
return \DevDojo\Themes\Models\Theme::where('active', '=', 1)->first();
return \Themes\Models\Theme::where('active', '=', 1)->first();
});
if(Cookie::get('theme')){
$theme_cookied = \DevDojo\Themes\Models\Theme::where('folder', '=', Cookie::get('theme'))->first();
$theme_cookied = \Themes\Models\Theme::where('folder', '=', Cookie::get('theme'))->first();
if(isset($theme_cookied->id)){
$theme = $theme_cookied;
}
Expand Down Expand Up @@ -97,7 +96,7 @@ public function boot()
*/
public function addThemeRoutes($router)
{
$namespacePrefix = '\\\DevDojo\\Themes\\Http\\Controllers\\';
$namespacePrefix = '\\Themes\\Http\\Controllers\\';
$router->get('themes', ['uses' => $namespacePrefix.'ThemesController@index', 'as' => 'theme.index']);
$router->get('themes/activate/{theme}', ['uses' => $namespacePrefix.'ThemesController@activate', 'as' => 'theme.activate']);
$router->get('themes/options/{theme}', ['uses' => $namespacePrefix.'ThemesController@options', 'as' => 'theme.options']);
Expand Down Expand Up @@ -166,7 +165,7 @@ private function loadDynamicMiddleware($themes_folder, $theme){
foreach($middleware_files as $middleware){
if($middleware != '.' && $middleware != '..'){
include($middleware_folder . '/' . $middleware);
$middleware_classname = 'DevDojo\\Themes\\Middleware\\' . str_replace('.php', '', $middleware);
$middleware_classname = 'Themes\\Middleware\\' . str_replace('.php', '', $middleware);
if(class_exists($middleware_classname)){
// Dynamically Load The Middleware
$this->app->make('Illuminate\Contracts\Http\Kernel')->prependMiddleware($middleware_classname);
Expand Down

0 comments on commit 40fce3b

Please sign in to comment.