Skip to content

Commit

Permalink
Adding SEO Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Mar 5, 2017
1 parent 72edcf8 commit 02e9e67
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 1 deletion.
10 changes: 10 additions & 0 deletions config/sidebar/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,15 @@
//
],
],
[
'title' => 'Settings',
'name' => 'seo-settings',
'route' => 'admin::seo.settings.index',
'icon' => 'fa fa-fw fa-cog',
'roles' => [Role::ADMINISTRATOR],
'permissions' => [
//
],
],
],
];
39 changes: 39 additions & 0 deletions resources/views/admin/settings.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@section('header')
<h1>SEO <small>Settings</small></h1>
@endsection

@section('content')
<div class="row">
<div class="col-md-4">
<div class="box">
<div class="box-header with-border">
<h2 class="box-title">URL Redirector</h2>
</div>
<div class="box-body no-padding">
<table class="table table-condensed table-hover no-margin">
<tr>
<th>Enabled :</th>
<td class="text-right">
<span class="label label-{{ $redirector['enabled'] ? 'success' : 'default' }}">
{{ $redirector['enabled'] ? 'Yes' : 'No' }}
</span>
</td>
</tr>
<tr>
<th>Driver :</th>
<td class="text-right">
<span class="label label-primary">{{ $redirector['default'] }}</span>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
@endsection

@section('modals')
@endsection

@section('scripts')
@endsection
1 change: 0 additions & 1 deletion src/Http/Controllers/Admin/RedirectsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use Arcanedev\LaravelSeo\Models\Redirect;
use Arcanesoft\Seo\Http\Requests\Admin\Redirects\CreateRedirectRequest;
use Arcanesoft\Seo\Http\Requests\Admin\Redirects\UpdateRedirectRequest;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;

/**
Expand Down
39 changes: 39 additions & 0 deletions src/Http/Controllers/Admin/SettingsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php namespace Arcanesoft\Seo\Http\Controllers\Admin;

use Arcanedev\LaravelSeo\Seo;

/**
* Class SettingsController
*
* @package Arcanesoft\Seo\Http\Controllers\Admin
* @author ARCANEDEV <arcanedev.maroc@gmail.com>
*
* @todo: Add authorization checks
*/
class SettingsController extends Controller
{
/* -----------------------------------------------------------------
| Constructor
| -----------------------------------------------------------------
*/
/**
* SettingsController constructor.
*/
public function __construct()
{
parent::__construct();

$this->setCurrentPage('seo-settings');
$this->addBreadcrumbRoute('Settings', 'admin::seo.settings.index');
}

public function index()
{
$this->setTitle($title = 'Settings');
$this->addBreadcrumb($title);

$redirector = Seo::getConfig('redirector');

return $this->view('admin.settings', compact('redirector'));
}
}
27 changes: 27 additions & 0 deletions src/Http/Routes/Admin/SettingsRoutes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php namespace Arcanesoft\Seo\Http\Routes\Admin;

use Arcanedev\Support\Routing\RouteRegistrar;

/**
* Class SettingsRoutes
*
* @package Arcanesoft\Seo\Http\Routes\Admin
* @author ARCANEDEV <arcanedev.maroc@gmail.com>
*/
class SettingsRoutes extends RouteRegistrar
{
/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
*/
/**
* Define the routes for the application.
*/
public function map()
{
$this->prefix('settings')->name('settings.')->group(function () {
$this->get('/', 'SettingsController@index')
->name('index');
});
}
}
5 changes: 5 additions & 0 deletions src/Providers/PackagesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Arcanedev\LaravelApiHelper\ApiHelperServiceProvider;
use Arcanedev\LaravelSeo\LaravelSeoServiceProvider;
use Arcanedev\LaravelSeo\Seo;
use Arcanedev\SpamBlocker\SpamBlockerServiceProvider;
use Arcanedev\Support\ServiceProvider;

Expand Down Expand Up @@ -39,6 +40,10 @@ public function register()
private function registerLaravelSeoPackage()
{
$this->registerProvider(LaravelSeoServiceProvider::class);

$this->app->booting(function () {
Seo::setConfig('redirector.default', 'eloquent');
});
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private function mapAdminRoutes()
Routes\Admin\MetasRoutes::register();
Routes\Admin\RedirectsRoutes::register();
Routes\Admin\SpammersRoutes::register();
Routes\Admin\SettingsRoutes::register();
});
}
}

0 comments on commit 02e9e67

Please sign in to comment.