Commit b66d9325 authored by Nicolas Widart's avatar Nicolas Widart

Squashed 'Modules/Core/' changes from dab167b..8c8f7be

8c8f7be Adding the authentication contract
23ce242 Use new setting interface
8b63175 Adapting the composer to the new interface
b3e2621 Adding the core settings to the core module
a8ebc0f Adding a title section

git-subtree-dir: Modules/Core
git-subtree-split: 8c8f7be3f38afbba75ee926dd1cf89220b171ae1
parent 07b6b405
<?php namespace Modules\Core\Composers;
use Illuminate\Contracts\View\View;
use Modules\Setting\Repositories\SettingRepository;
use Illuminate\Support\Facades\App;
use Modules\Core\Contracts\Setting;
class MasterViewComposer
{
/**
* @var SettingRepository
* @var Setting
*/
private $setting;
public function __construct(SettingRepository $setting)
public function __construct(Setting $setting)
{
$this->setting = $setting;
}
public function compose(View $view)
{
$view->with('sitename', $this->setting->findSettingForModule('site-name'));
$view->with('sitename', $this->setting->get('core::site-name', App::getLocale()));
}
}
<?php
return [
'site-name' => [
'description' => trans('core::settings.site-name'),
'view' => 'text',
'translatable' => true
],
'site-description' => [
'description' => trans('core::settings.site-description'),
'view' => 'textarea',
'translatable' => true
],
];
<?php namespace Modules\Core\Contracts;
interface Authentication
{
/**
* Authenticate a user
* @param array $credentials
* @param bool $remember Remember the user
* @return mixed
*/
public function login(array $credentials, $remember = false);
/**
* Register a new user.
* @param array $user
* @return bool
*/
public function register(array $user);
/**
* Activate the given used id
* @param int $userId
* @param string $code
* @return mixed
*/
public function activate($userId, $code);
/**
* Assign a role to the given user.
* @param \Modules\User\Repositories\UserRepository $user
* @param \Modules\User\Repositories\RoleRepository $role
* @return mixed
*/
public function assignRole($user, $role);
/**
* Log the user out of the application.
* @return mixed
*/
public function logout();
/**
* Create an activation code for the given user
* @param $user
* @return mixed
*/
public function createActivation($user);
/**
* Create a reminders code for the given user
* @param $user
* @return mixed
*/
public function createReminderCode($user);
/**
* Completes the reset password process
* @param $user
* @param string $code
* @param string $password
* @return bool
*/
public function completeResetPassword($user, $code, $password);
}
<?php namespace Modules\Core\Contracts;
interface Setting
{
/**
* Determine if the given configuration value exists.
*
* @param string $key
* @return bool
*/
public function has($key);
/**
* Get the specified configuration value in the given language
*
* @param string $key
* @param string $locale
* @param mixed $default
* @return string
*/
public function get($key, $locale = null, $default = null);
/**
* Set a given configuration value.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function set($key, $value);
}
......@@ -21,5 +21,9 @@ return [
],
'breadcrumb' => [
'home' => 'Home'
],
'title' => [
'translatable fields' => 'Translatable fields',
'non translatable fields' => 'Non translatable fields',
]
];
<?php
return [
'site-name' => 'Site name',
'site-description' => 'Site description',
];
......@@ -21,5 +21,9 @@ return [
'tab' => [
'english' => 'Anglais',
'french' => 'Français',
],
'title' => [
'translatable fields' => 'Champs traduisible',
'non translatable fields' => 'Champs non traduisible',
]
];
<?php
return [
'site-name' => 'Nom du site',
'site-description' => 'Description du site',
];
......@@ -34,7 +34,7 @@
<header class="header">
<a href="{{ URL::route('dashboard.index') }}" class="logo">
<?php if (isset($sitename)): ?>
{{ $sitename->translate(App::getLocale())->value }}
{{ $sitename }}
<?php endif; ?>
</a>
@include('core::partials.top-nav')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment