Skip to content

Commit

Permalink
Adding the latest content
Browse files Browse the repository at this point in the history
  • Loading branch information
tnylea-tcg committed Mar 30, 2020
1 parent 7dfed58 commit 1334517
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/Http/Controllers/ThemesController.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Themes\Http\Controllers;
namespace DevDojo\Themes\Http\Controllers;

use Voyager;
use Illuminate\Http\Request;
use \Themes\Models\Theme;
use \DevDojo\Themes\Models\Theme;
use Illuminate\Support\Facades\File;
use \Themes\Models\ThemeOptions;
use \DevDojo\Themes\Models\ThemeOptions;
use TCG\Voyager\Http\Controllers\Controller;

class ThemesController extends Controller
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Theme.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Themes\Models;
namespace DevDojo\Themes\Models;

use Illuminate\Database\Eloquent\Model;

Expand All @@ -11,6 +11,6 @@ class Theme extends Model
protected $fillable = ['name', 'folder', 'version'];

public function options(){
return $this->hasMany('\Themes\Models\ThemeOptions', 'theme_id');
return $this->hasMany('\DevDojo\Themes\Models\ThemeOptions', 'theme_id');
}
}
2 changes: 1 addition & 1 deletion src/Models/ThemeOptions.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Themes\Models;
namespace DevDojo\Themes\Models;

use Illuminate\Database\Eloquent\Model;

Expand Down
11 changes: 6 additions & 5 deletions src/ThemesServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Themes;
namespace DevDojo\Themes;

use Illuminate\Http\Request;
use TCG\Voyager\Models\Menu;
Expand Down Expand Up @@ -28,6 +28,7 @@ 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 @@ -62,10 +63,10 @@ public function boot()

if (Schema::hasTable('themes')) {
$theme = $this->rescue(function () {
return \Themes\Models\Theme::where('active', '=', 1)->first();
return \DevDojo\Themes\Models\Theme::where('active', '=', 1)->first();
});
if(Cookie::get('theme')){
$theme_cookied = \Themes\Models\Theme::where('folder', '=', Cookie::get('theme'))->first();
$theme_cookied = \DevDojo\Themes\Models\Theme::where('folder', '=', Cookie::get('theme'))->first();
if(isset($theme_cookied->id)){
$theme = $theme_cookied;
}
Expand Down Expand Up @@ -96,7 +97,7 @@ public function boot()
*/
public function addThemeRoutes($router)
{
$namespacePrefix = '\\Themes\\Http\\Controllers\\';
$namespacePrefix = '\\\DevDojo\\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 @@ -165,7 +166,7 @@ private function loadDynamicMiddleware($themes_folder, $theme){
foreach($middleware_files as $middleware){
if($middleware != '.' && $middleware != '..'){
include($middleware_folder . '/' . $middleware);
$middleware_classname = 'Themes\\Middleware\\' . str_replace('.php', '', $middleware);
$middleware_classname = 'DevDojo\\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
14 changes: 7 additions & 7 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

function theme_field($type, $key, $title, $content = '', $details = '', $placeholder = '', $required = 0){

$theme = \Themes\Models\Theme::where('folder', '=', ACTIVE_THEME_FOLDER)->first();
$theme = \DevDojo\Themes\Models\Theme::where('folder', '=', ACTIVE_THEME_FOLDER)->first();

$option_exists = $theme->options->where('key', '=', $key)->first();

Expand All @@ -26,10 +26,10 @@ function theme_field($type, $key, $title, $content = '', $details = '', $placeho
if (!function_exists(theme)){

function theme($key, $default = ''){
$theme = \Themes\Models\Theme::where('active', '=', 1)->first();
$theme = \DevDojo\Themes\Models\Theme::where('active', '=', 1)->first();

if(Cookie::get('theme')){
$theme_cookied = \Themes\Models\Theme::where('folder', '=', Cookie::get('theme'))->first();
$theme_cookied = \DevDojo\Themes\Models\Theme::where('folder', '=', Cookie::get('theme'))->first();
if(isset($theme_cookied->id)){
$theme = $theme_cookied;
}
Expand All @@ -53,10 +53,10 @@ function theme_folder($folder_file = ''){
return 'themes/' . THEME_FOLDER . $folder_file;
}

$theme = \Themes\Models\Theme::where('active', '=', 1)->first();
$theme = \DevDojo\Themes\Models\Theme::where('active', '=', 1)->first();

if(Cookie::get('theme')){
$theme_cookied = \Themes\Models\Theme::where('folder', '=', Cookie::get('theme'))->first();
$theme_cookied = \DevDojo\Themes\Models\Theme::where('folder', '=', Cookie::get('theme'))->first();
if(isset($theme_cookied->id)){
$theme = $theme_cookied;
}
Expand All @@ -74,10 +74,10 @@ function theme_folder_url($folder_file = ''){
return url('themes/' . THEME_FOLDER . $folder_file);
}

$theme = \Themes\Models\Theme::where('active', '=', 1)->first();
$theme = \DevDojo\Themes\Models\Theme::where('active', '=', 1)->first();

if(Cookie::get('theme')){
$theme_cookied = \Themes\Models\Theme::where('folder', '=', Cookie::get('theme'))->first();
$theme_cookied = \DevDojo\Themes\Models\Theme::where('folder', '=', Cookie::get('theme'))->first();
if(isset($theme_cookied->id)){
$theme = $theme_cookied;
}
Expand Down

0 comments on commit 1334517

Please sign in to comment.