Commit 668d74b9 authored by Nicolas Widart's avatar Nicolas Widart

Merge commit 'faa1740d'

* commit 'faa1740d':
  Squashed 'Modules/Core/' changes from eec30df..1f638cf
parents 2ae07c91 faa1740d
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -10,4 +10,4 @@ class SidebarViewCreator
$view->prefix = Config::get('core::core.admin-prefix');
$view->items = new Collection;
}
}
\ No newline at end of file
}
......@@ -12,4 +12,4 @@ return [
'User',
'Workshop'
]
];
\ No newline at end of file
];
......@@ -7,4 +7,4 @@ return [
|--------------------------------------------------------------------------
*/
'admin-prefix' => 'backend'
];
\ No newline at end of file
];
......@@ -3,7 +3,6 @@
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Hash;
use Modules\User\Repositories\RoleRepository;
use Modules\User\Repositories\UserRepository;
class InstallCommand extends Command
......@@ -27,10 +26,6 @@ class InstallCommand extends Command
*/
private $user;
/**
* @var RoleRepository
*/
private $role;
/**
* @var Filesystem
*/
......@@ -40,15 +35,13 @@ class InstallCommand extends Command
* Create a new command instance.
*
* @param UserRepository $user
* @param RoleRepository $role
* @param Filesystem $finder
* @return \Modules\Core\Console\InstallCommand
*/
public function __construct($user, $role, Filesystem $finder)
public function __construct($user, Filesystem $finder)
{
parent::__construct();
$this->user = $user;
$this->role = $role;
$this->finder = $finder;
}
......
......@@ -13,8 +13,8 @@ class CoreDatabaseSeeder extends Seeder {
public function run()
{
Model::unguard();
// $this->call("OthersTableSeeder");
}
}
\ No newline at end of file
}
......@@ -8,4 +8,4 @@ class AdminBaseController
public function __construct()
{
}
}
\ No newline at end of file
}
......@@ -26,4 +26,4 @@ class AdminFilter
return App::abort(403);
}
}
}
\ No newline at end of file
}
<?php namespace Modules\Core\Http\Filters;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Redirect;
use Laracasts\Flash\Flash;
class PermissionFilter
{
public function filter($route, $request)
public function filter(Route $route, Request $request)
{
$action = $route->getActionName();
$actionMethod = substr($action, strpos($action, "@") + 1);
......@@ -28,7 +30,7 @@ class PermissionFilter
* @param $request
* @return mixed
*/
private function getSegmentPosition($request)
private function getSegmentPosition(Request $request)
{
$segmentPosition = 2;
......@@ -38,4 +40,4 @@ class PermissionFilter
return $segmentPosition;
}
}
\ No newline at end of file
}
......@@ -11,4 +11,4 @@ if (App::environment() == 'testing') {
$lang = 'fr';
}
App::setLocale($lang);
\ No newline at end of file
App::setLocale($lang);
......@@ -11,16 +11,21 @@ class Helper
* @param $model
* @param $data
*/
public static function saveTranslated($model, $data)
public static function updateTranslated($model, $data)
{
foreach ($data as $lang => $value) {
if (is_array($value)) {
foreach ($value as $key => $input) {
$model->translate($lang)->$key = $input;
}
}
}
$model->save();
self::saveTranslatedProperties($model, $data);
}
/**
* Create the given model and save its translated attributes
* @param $model
* @param $data
*/
public static function createTranslatedFields($model, $data)
{
$model = new $model;
self::saveTranslatedProperties($model, $data);
}
/**
......@@ -44,20 +49,20 @@ class Helper
}
/**
* Create the given model and save its translated attributes
* Save the given properties for the model
* @param $model
* @param $data
*/
public static function createTranslatedFields($model, $data)
private static function saveTranslatedProperties($model, $data)
{
$model = new $model;
foreach ($data as $key => $value) {
foreach ($data as $lang => $value) {
if (is_array($value)) {
foreach ($value as $lang => $input) {
foreach ($value as $key => $input) {
$model->translate($lang)->$key = $input;
}
}
}
$model->save();
}
}
\ No newline at end of file
}
......@@ -30,4 +30,4 @@ class NavigationOrdener
{
return isset($item['weight']) ? $item : $item->first();
}
}
\ No newline at end of file
}
......@@ -50,4 +50,4 @@ class PermissionManager
}
return $cleanedPermissions;
}
}
\ No newline at end of file
}
......@@ -3,7 +3,6 @@
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Modules\Core\Console\InstallCommand;
use Modules\User\Events\RegisterSidebarMenuItemEvent;
class CoreServiceProvider extends ServiceProvider
{
......@@ -106,7 +105,6 @@ class CoreServiceProvider extends ServiceProvider
$this->app->bindShared('command.platform.install', function($app) {
return new InstallCommand(
$app['Modules\User\Repositories\UserRepository'],
$app['Modules\User\Repositories\RoleRepository'],
$app['files']
);
});
......
......@@ -22,4 +22,4 @@ return [
'breadcrumb' => [
'home' => 'Home'
]
];
\ No newline at end of file
];
......@@ -22,4 +22,4 @@ return [
'english' => 'Anglais',
'french' => 'Français',
]
];
\ No newline at end of file
];
......@@ -9,17 +9,17 @@
</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- bootstrap 3.0.2 -->
<link href="{{{ core_asset('css/vendor/bootstrap.min.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ Module::asset('core', 'css/vendor/bootstrap.min.css') }}}" rel="stylesheet" type="text/css" />
<!-- font Awesome -->
<link href="{{{ core_asset('css/vendor/font-awesome.min.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ Module::asset('core', 'css/vendor/font-awesome.min.css') }}}" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="{{{ core_asset('css/vendor/ionicons.min.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ core_asset('css/vendor/alertify/alertify.core.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ core_asset('css/vendor/alertify/alertify.default.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ core_asset('css/vendor/datatables/dataTables.bootstrap.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ Module::asset('core', 'css/vendor/ionicons.min.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ Module::asset('core', 'css/vendor/alertify/alertify.core.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ Module::asset('core', 'css/vendor/alertify/alertify.default.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ Module::asset('core', 'css/vendor/datatables/dataTables.bootstrap.css') }}}" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="{{{ core_asset('css/AdminLTE.css') }}}" rel="stylesheet" type="text/css" />
<script src="{{{ core_asset('js/vendor/jquery.min.js') }}}"></script>
<link href="{{{ Module::asset('core', 'css/AdminLTE.css') }}}" rel="stylesheet" type="text/css" />
<script src="{{{ Module::asset('core', 'js/vendor/jquery.min.js') }}}"></script>
@section('styles')
@show
......@@ -55,13 +55,13 @@
</aside><!-- /.right-side -->
</div><!-- ./wrapper -->
<script src="{{{ core_asset('js/vendor/bootstrap.min.js') }}}" type="text/javascript"></script>
<script src="{{{ core_asset('js/vendor/alertify/alertify.js') }}}" type="text/javascript"></script>
<script src="{{{ core_asset('js/vendor/iCheck/icheck.min.js') }}}" type="text/javascript"></script>
<script src="{{{ core_asset('js/vendor/datatables/jquery.dataTables.js') }}}" type="text/javascript"></script>
<script src="{{{ core_asset('js/vendor/datatables/dataTables.bootstrap.js') }}}" type="text/javascript"></script>
<script src="{{{ core_asset('js/app.js') }}}" type="text/javascript"></script>
<script src="{{{ Module::asset('core', 'js/vendor/bootstrap.min.js') }}}" type="text/javascript"></script>
<script src="{{{ Module::asset('core', 'js/vendor/alertify/alertify.js') }}}" type="text/javascript"></script>
<script src="{{{ Module::asset('core', 'js/vendor/iCheck/icheck.min.js') }}}" type="text/javascript"></script>
<script src="{{{ Module::asset('core', 'js/vendor/datatables/jquery.dataTables.js') }}}" type="text/javascript"></script>
<script src="{{{ Module::asset('core', 'js/vendor/datatables/dataTables.bootstrap.js') }}}" type="text/javascript"></script>
<script src="{{{ Module::asset('core', 'js/app.js') }}}" type="text/javascript"></script>
@section('scripts')
@show
</body>
</html>
\ No newline at end of file
</html>
......@@ -48,4 +48,4 @@
</ul>
</section>
<!-- /.sidebar -->
</aside>
\ No newline at end of file
</aside>
......@@ -66,4 +66,4 @@
</li>
</ul>
</div>
</nav>
\ No newline at end of file
</nav>
<?php namespace Modules\Core\Tests;
use TestCase;
abstract class BaseTestCase extends TestCase
{
protected function checkResponseIsOkAndContains($request, $filter)
{
$crawler = $this->client->request($request[0], $request[1]);
$this->assertTrue($this->client->getResponse()->isOk());
$this->assertCount(1, $crawler->filter($filter));
}
}
<?php
if (!function_exists('core_asset')) {
function core_asset($url, array $attributes = [], $secure = false)
{
return Module::asset('core', $url, $attributes, $secure);
}
}
\ No newline at end of file
# Core Module
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/57e26b38-6275-4608-96e2-44047aaed5c2/mini.png)](https://insight.sensiolabs.com/projects/57e26b38-6275-4608-96e2-44047aaed5c2)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nWidart-Modules/Core/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nWidart-Modules/Core/?branch=master)
......@@ -27,4 +27,3 @@ Config::addNamespace('core', __DIR__ . '/Config/');
require __DIR__ . '/Http/routes.php';
require __DIR__ . '/composers.php';
require __DIR__ . '/helpers.php';
\ No newline at end of file
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