¨4.0.1¨
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
namespace Modules\Core\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AdminMiddleware
|
||||
{
|
||||
@@ -16,12 +18,14 @@ class AdminMiddleware
|
||||
'admin.reset.*',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
@@ -36,10 +40,12 @@ class AdminMiddleware
|
||||
return redirect()->guest(route('admin.login'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if the request URI is in except array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function inExceptArray($request)
|
||||
|
||||
@@ -3,15 +3,18 @@
|
||||
namespace Modules\Core\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class Authenticate
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
@@ -21,7 +24,7 @@ class Authenticate
|
||||
|
||||
$url = url()->full();
|
||||
|
||||
if (! $request->isMethod('get')) {
|
||||
if (!$request->isMethod('get')) {
|
||||
$url = url()->previous();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,29 +4,33 @@ namespace Modules\Core\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class Authorization
|
||||
{
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
* @param string $permission
|
||||
* @param string $to
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, $permission, $to = '')
|
||||
{
|
||||
if (! auth()->user()->hasAccess($permission)) {
|
||||
if (!auth()->user()->hasAccess($permission)) {
|
||||
return $this->handleUnauthorizedRequest($request, $permission);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Request $request
|
||||
* @param string $permission
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
private function handleUnauthorizedRequest(Request $request, $permission)
|
||||
{
|
||||
|
||||
@@ -4,15 +4,17 @@ namespace Modules\Core\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class GuestMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Modules\Core\Http\Requests;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
abstract class Request extends FormRequest
|
||||
@@ -21,20 +22,12 @@ abstract class Request extends FormRequest
|
||||
*/
|
||||
protected $localeKey;
|
||||
|
||||
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom attributes for validator errors.
|
||||
@@ -45,13 +38,14 @@ abstract class Request extends FormRequest
|
||||
{
|
||||
$attributes = trans($this->availableAttributes) ?: [];
|
||||
|
||||
if (! is_array($attributes)) {
|
||||
if (!is_array($attributes)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return array_map('mb_strtolower', array_dot($attributes));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
@@ -72,6 +66,18 @@ abstract class Request extends FormRequest
|
||||
return $messages;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse rules for the given attributes.
|
||||
*
|
||||
@@ -87,6 +93,7 @@ abstract class Request extends FormRequest
|
||||
* ]
|
||||
*
|
||||
* @param array $rules
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function parseRules(array $rules)
|
||||
@@ -94,17 +101,17 @@ abstract class Request extends FormRequest
|
||||
$attributesAndRules = [];
|
||||
|
||||
foreach ($rules as $attribute => $rulesList) {
|
||||
if (! is_array($rulesList)) {
|
||||
if (!is_array($rulesList)) {
|
||||
$rulesList = explode('|', $rulesList);
|
||||
}
|
||||
|
||||
foreach ($rulesList as $rule) {
|
||||
if ($rule instanceof Closure) {
|
||||
if ($rule instanceof Closure || $rule instanceof Rule) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strpos($rule, ':') !== false) {
|
||||
list($rule) = explode(':', $rule, 2);
|
||||
if (str_contains($rule, ':')) {
|
||||
[$rule] = explode(':', $rule, 2);
|
||||
}
|
||||
|
||||
$attributesAndRules[] = "{$attribute}.{$rule}";
|
||||
|
||||
@@ -6,8 +6,16 @@ use Exception;
|
||||
use Modules\Support\Locale;
|
||||
use Modules\Setting\Entities\Setting;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use FleetCart\Http\Middleware\LicenseChecker;
|
||||
use Modules\Core\Http\Middleware\Authenticate;
|
||||
use Modules\Core\Http\Middleware\Authorization;
|
||||
use Modules\Core\Http\Middleware\GuestMiddleware;
|
||||
use Modules\Core\Http\Middleware\AdminMiddleware;
|
||||
use Modules\Setting\Repository as SettingRepository;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
use Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect;
|
||||
use Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRoutes;
|
||||
use Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRedirectFilter;
|
||||
|
||||
class CoreServiceProvider extends ServiceProvider
|
||||
{
|
||||
@@ -17,15 +25,17 @@ class CoreServiceProvider extends ServiceProvider
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
'auth' => \Modules\Core\Http\Middleware\Authenticate::class,
|
||||
'admin' => \Modules\Core\Http\Middleware\AdminMiddleware::class,
|
||||
'guest' => \Modules\Core\Http\Middleware\GuestMiddleware::class,
|
||||
'can' => \Modules\Core\Http\Middleware\Authorization::class,
|
||||
'localize' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRoutes::class,
|
||||
'locale_session_redirect' => \Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect::class,
|
||||
'localization_redirect' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRedirectFilter::class,
|
||||
'auth' => Authenticate::class,
|
||||
'admin' => AdminMiddleware::class,
|
||||
'licensed' => LicenseChecker::class,
|
||||
'guest' => GuestMiddleware::class,
|
||||
'can' => Authorization::class,
|
||||
'localize' => LaravelLocalizationRoutes::class,
|
||||
'locale_session_redirect' => LocaleSessionRedirect::class,
|
||||
'localization_redirect' => LaravelLocalizationRedirectFilter::class,
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
@@ -33,7 +43,7 @@ class CoreServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
if (! config('app.installed')) {
|
||||
if (!config('app.installed')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -49,6 +59,7 @@ class CoreServiceProvider extends ServiceProvider
|
||||
$this->blacklistAdminRoutesOnFrontend();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup supported locales.
|
||||
*
|
||||
@@ -65,6 +76,7 @@ class CoreServiceProvider extends ServiceProvider
|
||||
$this->app['config']->set('laravellocalization.supportedLocales', $supportedLocales);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get supported locales from database.
|
||||
*
|
||||
@@ -79,17 +91,6 @@ class CoreServiceProvider extends ServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide default locale in url for non multi-locale mode.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function hideDefaultLocaleInURL()
|
||||
{
|
||||
if (! is_multilingual()) {
|
||||
$this->app['config']->set('laravellocalization.hideDefaultLocaleInURL', true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register setting binding.
|
||||
@@ -103,6 +104,7 @@ class CoreServiceProvider extends ServiceProvider
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup application locale.
|
||||
*
|
||||
@@ -118,6 +120,7 @@ class CoreServiceProvider extends ServiceProvider
|
||||
LaravelLocalization::setLocale($locale);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup application cache driver.
|
||||
*
|
||||
@@ -128,6 +131,20 @@ class CoreServiceProvider extends ServiceProvider
|
||||
$this->app['config']->set('cache.default', config('app.cache') ? 'file' : 'array');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Hide default locale in url for non multi-locale mode.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function hideDefaultLocaleInURL()
|
||||
{
|
||||
if (!is_multilingual()) {
|
||||
$this->app['config']->set('laravellocalization.hideDefaultLocaleInURL', true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup application timezone.
|
||||
*
|
||||
@@ -142,6 +159,7 @@ class CoreServiceProvider extends ServiceProvider
|
||||
$this->app['config']->set('app.timezone', $timezone);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup application mail config.
|
||||
*
|
||||
@@ -159,6 +177,7 @@ class CoreServiceProvider extends ServiceProvider
|
||||
$this->app['config']->set('mail.mailers.smtp.encryption', setting('mail_encryption'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register the filters.
|
||||
*
|
||||
@@ -171,6 +190,7 @@ class CoreServiceProvider extends ServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register inAdminPanel state to the IoC container.
|
||||
*
|
||||
@@ -189,6 +209,7 @@ class CoreServiceProvider extends ServiceProvider
|
||||
$this->app['inAdminPanel'] = $this->app['request']->segment($index) === 'admin';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Blacklist admin routes on frontend for ziggy package.
|
||||
*
|
||||
@@ -196,7 +217,7 @@ class CoreServiceProvider extends ServiceProvider
|
||||
*/
|
||||
private function blacklistAdminRoutesOnFrontend()
|
||||
{
|
||||
if (! $this->app['inAdminPanel']) {
|
||||
if (!$this->app['inAdminPanel']) {
|
||||
$this->app['config']->set('ziggy.blacklist', ['admin.*']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,12 @@ class ModuleServiceProvider extends ServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load views for the given module.
|
||||
*
|
||||
* @param \Nwidart\Modules\Module $module
|
||||
* @param Module $module
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loadViews(Module $module)
|
||||
@@ -35,10 +37,12 @@ class ModuleServiceProvider extends ServiceProvider
|
||||
$this->loadViewsFrom("{$module->getPath()}/Resources/views", $module->get('alias'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load translations for the given module.
|
||||
*
|
||||
* @param \Nwidart\Modules\Module $module
|
||||
* @param Module $module
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loadTranslations(Module $module)
|
||||
@@ -46,17 +50,18 @@ class ModuleServiceProvider extends ServiceProvider
|
||||
$this->loadTranslationsFrom("{$module->getPath()}/Resources/lang", $module->get('alias'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load migrations for the given module.
|
||||
*
|
||||
* @param \Nwidart\Modules\Module $module
|
||||
* @param Module $module
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loadConfigs(Module $module)
|
||||
{
|
||||
collect([
|
||||
'config' => "{$module->getPath()}/Config/config.php",
|
||||
'assets' => "{$module->getPath()}/Config/assets.php",
|
||||
'permissions' => "{$module->getPath()}/Config/permissions.php",
|
||||
])->filter(function ($path) {
|
||||
return file_exists($path);
|
||||
@@ -65,10 +70,12 @@ class ModuleServiceProvider extends ServiceProvider
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load migrations for the given module.
|
||||
*
|
||||
* @param \Nwidart\Modules\Module $module
|
||||
* @param Module $module
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loadMigrations(Module $module)
|
||||
@@ -76,10 +83,12 @@ class ModuleServiceProvider extends ServiceProvider
|
||||
$this->loadMigrationsFrom("{$module->getPath()}/Database/Migrations");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load model factories for the given module.
|
||||
*
|
||||
* @param \Nwidart\Modules\Module $module
|
||||
* @param Module $module
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loadModelFactories(Module $module)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Modules\Core\Providers;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
@@ -10,8 +11,6 @@ class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
@@ -21,6 +20,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Map routes from all enabled modules.
|
||||
*
|
||||
@@ -37,6 +37,79 @@ class RouteServiceProvider extends ServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Group routes to common prefix and middleware.
|
||||
*
|
||||
* @param string $namespace
|
||||
* @param Closure $callback
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function groupRoutes($namespace, $callback)
|
||||
{
|
||||
Route::group([
|
||||
'namespace' => $namespace,
|
||||
'prefix' => LaravelLocalization::setLocale(),
|
||||
'middleware' => ['localize', 'locale_session_redirect', 'localization_redirect', 'web'],
|
||||
], function () use ($callback) {
|
||||
$callback();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Map admin routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function mapAdminRoutes($path)
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Route::group([
|
||||
'namespace' => 'Admin',
|
||||
'prefix' => 'admin',
|
||||
'middleware' => ['admin', 'licensed'],
|
||||
], function () use ($path) {
|
||||
require_once $path;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Map public routes.
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function mapPublicRoutes($path)
|
||||
{
|
||||
if (file_exists($path)) {
|
||||
require_once $path;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function mapApiRoutes($path)
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Route::group([
|
||||
'namespace' => 'Api',
|
||||
'prefix' => 'api',
|
||||
'middleware' => ['api'],
|
||||
], function () use ($path) {
|
||||
require_once $path;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Map routes from active theme.
|
||||
*
|
||||
@@ -52,70 +125,4 @@ class RouteServiceProvider extends ServiceProvider
|
||||
$this->mapApiRoutes("{$theme->getPath()}/routes/api.php");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Group routes to common prefix and middleware.
|
||||
*
|
||||
* @param string $namespace
|
||||
* @param \Closure $callback
|
||||
* @return void
|
||||
*/
|
||||
private function groupRoutes($namespace, $callback)
|
||||
{
|
||||
Route::group([
|
||||
'namespace' => $namespace,
|
||||
'prefix' => LaravelLocalization::setLocale(),
|
||||
'middleware' => ['localize', 'locale_session_redirect', 'localization_redirect', 'web'],
|
||||
], function () use ($callback) {
|
||||
$callback();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Map admin routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function mapAdminRoutes($path)
|
||||
{
|
||||
if (! file_exists($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Route::group([
|
||||
'namespace' => 'Admin',
|
||||
'prefix' => 'admin',
|
||||
'middleware' => ['admin'],
|
||||
], function () use ($path) {
|
||||
require_once $path;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Map public routes.
|
||||
*
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
private function mapPublicRoutes($path)
|
||||
{
|
||||
if (file_exists($path)) {
|
||||
require_once $path;
|
||||
}
|
||||
}
|
||||
|
||||
private function mapApiRoutes($path)
|
||||
{
|
||||
if (! file_exists($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Route::group([
|
||||
'namespace' => 'Api',
|
||||
'prefix' => 'api',
|
||||
'middleware' => ['api'],
|
||||
], function () use ($path) {
|
||||
require_once $path;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class SearchEngineServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
if (! config('app.installed')) {
|
||||
if (!config('app.installed')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class ThemeServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
if (! config('app.installed')) {
|
||||
if (!config('app.installed')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,10 +30,12 @@ class ThemeServiceProvider extends ServiceProvider
|
||||
$this->bootTheme($this->app['stylist']->get($activeTheme));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Boot the given theme.
|
||||
*
|
||||
* @param \Mehedi\Stylist\Theme\Theme $theme
|
||||
* @param Theme $theme
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function bootTheme(Theme $theme)
|
||||
@@ -50,10 +52,12 @@ class ThemeServiceProvider extends ServiceProvider
|
||||
$this->requireFiles($theme, $files);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register given service providers.
|
||||
*
|
||||
* @param array $providers
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function registerProviders($providers = [])
|
||||
@@ -63,11 +67,13 @@ class ThemeServiceProvider extends ServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load translations for the given theme.
|
||||
*
|
||||
* @param string $themeAlias
|
||||
* @param \Mehedi\Stylist\Theme\Theme $theme
|
||||
* @param Theme $theme
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loadTranslations(Theme $theme, $themeAlias)
|
||||
@@ -75,11 +81,13 @@ class ThemeServiceProvider extends ServiceProvider
|
||||
$this->loadTranslationsFrom("{$theme->getPath()}/resources/lang", $themeAlias);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load configs for the given theme.
|
||||
*
|
||||
* @param string $themeAlias
|
||||
* @param \Mehedi\Stylist\Theme\Theme $theme
|
||||
* @param Theme $theme
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loadConfigs(Theme $theme, $themeAlias)
|
||||
@@ -95,11 +103,13 @@ class ThemeServiceProvider extends ServiceProvider
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Require the given files.
|
||||
*
|
||||
* @param \Mehedi\Stylist\Theme\Theme $theme
|
||||
* @param Theme $theme
|
||||
* @param array $files
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function requireFiles(Theme $theme, $files = [])
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'the_given_data_was_invalid' => 'The given data was invalid.',
|
||||
'mail_is_not_configured' => 'Mail is not configured properly.',
|
||||
'the_given_data_was_invalid' => 'The given data was invalid',
|
||||
'mail_is_not_configured' => 'Mail is not configured properly',
|
||||
'something_went_wrong' => 'Something went wrong!',
|
||||
];
|
||||
|
||||
@@ -1,80 +1,80 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'captcha' => 'The captcha code is incorrect.',
|
||||
'redis' => 'Could not connect to the redis server.',
|
||||
'accepted' => 'The :attribute must be accepted.',
|
||||
'active_url' => 'The :attribute is not a valid URL.',
|
||||
'after' => 'The :attribute must be a date after :date.',
|
||||
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
|
||||
'alpha' => 'The :attribute may only contain letters.',
|
||||
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
|
||||
'alpha_num' => 'The :attribute may only contain letters and numbers.',
|
||||
'array' => 'The :attribute must be an array.',
|
||||
'before' => 'The :attribute must be a date before :date.',
|
||||
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
|
||||
'between' => [
|
||||
'numeric' => 'The :attribute must be between :min and :max.',
|
||||
'file' => 'The :attribute must be between :min and :max kilobytes.',
|
||||
'string' => 'The :attribute must be between :min and :max characters.',
|
||||
'array' => 'The :attribute must have between :min and :max items.',
|
||||
'captcha' => 'The captcha code is incorrect',
|
||||
'redis' => 'Could not connect to the redis server',
|
||||
'accepted' => 'The :attribute must be accepted',
|
||||
'active_url' => 'The :attribute is not a valid URL',
|
||||
'after' => 'The :attribute must be a date after :date',
|
||||
'after_or_equal' => 'The :attribute must be a date after or equal to :date',
|
||||
'alpha' => 'The :attribute may only contain letters',
|
||||
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes',
|
||||
'alpha_num' => 'The :attribute may only contain letters and numbers',
|
||||
'array' => 'The :attribute must be an array',
|
||||
'before' => 'The :attribute must be a date before :date',
|
||||
'before_or_equal' => 'The :attribute must be a date before or equal to :date',
|
||||
'between' => [
|
||||
'numeric' => 'The :attribute must be between :min and :max',
|
||||
'file' => 'The :attribute must be between :min and :max kilobytes',
|
||||
'string' => 'The :attribute must be between :min and :max characters',
|
||||
'array' => 'The :attribute must have between :min and :max items',
|
||||
],
|
||||
'boolean' => 'The :attribute field must be true or false.',
|
||||
'confirmed' => 'The :attribute confirmation does not match.',
|
||||
'date' => 'The :attribute is not a valid date.',
|
||||
'date_format' => 'The :attribute does not match the format :format.',
|
||||
'different' => 'The :attribute and :other must be different.',
|
||||
'digits' => 'The :attribute must be :digits digits.',
|
||||
'digits_between' => 'The :attribute must be between :min and :max digits.',
|
||||
'dimensions' => 'The :attribute has invalid image dimensions.',
|
||||
'distinct' => 'The :attribute field has a duplicate value.',
|
||||
'email' => 'The :attribute must be a valid email address.',
|
||||
'exists' => 'The selected :attribute is invalid.',
|
||||
'file' => 'The :attribute must be a file.',
|
||||
'filled' => 'The :attribute field must have a value.',
|
||||
'image' => 'The :attribute must be an image.',
|
||||
'in' => 'The selected :attribute is invalid.',
|
||||
'in_array' => 'The :attribute field does not exist in :other.',
|
||||
'integer' => 'The :attribute must be an integer.',
|
||||
'ip' => 'The :attribute must be a valid IP address.',
|
||||
'ipv4' => 'The :attribute must be a valid IPv4 address.',
|
||||
'ipv6' => 'The :attribute must be a valid IPv6 address.',
|
||||
'json' => 'The :attribute must be a valid JSON string.',
|
||||
'max' => [
|
||||
'numeric' => 'The :attribute may not be greater than :max.',
|
||||
'file' => 'The :attribute may not be greater than :max kilobytes.',
|
||||
'string' => 'The :attribute may not be greater than :max characters.',
|
||||
'array' => 'The :attribute may not have more than :max items.',
|
||||
'boolean' => 'The :attribute field must be true or false',
|
||||
'confirmed' => 'The :attribute confirmation does not match',
|
||||
'date' => 'The :attribute is not a valid date',
|
||||
'date_format' => 'The :attribute does not match the format :format',
|
||||
'different' => 'The :attribute and :other must be different',
|
||||
'digits' => 'The :attribute must be :digits digits',
|
||||
'digits_between' => 'The :attribute must be between :min and :max digits',
|
||||
'dimensions' => 'The :attribute has invalid image dimensions',
|
||||
'distinct' => 'The :attribute field has a duplicate value',
|
||||
'email' => 'The :attribute must be a valid email address',
|
||||
'exists' => 'The selected :attribute is invalid',
|
||||
'file' => 'The :attribute must be a file',
|
||||
'filled' => 'The :attribute field must have a value',
|
||||
'image' => 'The :attribute must be an image',
|
||||
'in' => 'The selected :attribute is invalid',
|
||||
'in_array' => 'The :attribute field does not exist in :other',
|
||||
'integer' => 'The :attribute must be an integer',
|
||||
'ip' => 'The :attribute must be a valid IP address',
|
||||
'ipv4' => 'The :attribute must be a valid IPv4 address',
|
||||
'ipv6' => 'The :attribute must be a valid IPv6 address',
|
||||
'json' => 'The :attribute must be a valid JSON string',
|
||||
'max' => [
|
||||
'numeric' => 'The :attribute may not be greater than :max',
|
||||
'file' => 'The :attribute may not be greater than :max kilobytes',
|
||||
'string' => 'The :attribute may not be greater than :max characters',
|
||||
'array' => 'The :attribute may not have more than :max items',
|
||||
],
|
||||
'mimes' => 'The :attribute must be a file of type: :values.',
|
||||
'mimetypes' => 'The :attribute must be a file of type: :values.',
|
||||
'min' => [
|
||||
'numeric' => 'The :attribute must be at least :min.',
|
||||
'file' => 'The :attribute must be at least :min kilobytes.',
|
||||
'string' => 'The :attribute must be at least :min characters.',
|
||||
'array' => 'The :attribute must have at least :min items.',
|
||||
'mimes' => 'The :attribute must be a file of type: :values',
|
||||
'mimetypes' => 'The :attribute must be a file of type: :values',
|
||||
'min' => [
|
||||
'numeric' => 'The :attribute must be at least :min',
|
||||
'file' => 'The :attribute must be at least :min kilobytes',
|
||||
'string' => 'The :attribute must be at least :min characters',
|
||||
'array' => 'The :attribute must have at least :min items',
|
||||
],
|
||||
'not_in' => 'The selected :attribute is invalid.',
|
||||
'numeric' => 'The :attribute must be a number.',
|
||||
'present' => 'The :attribute field must be present.',
|
||||
'regex' => 'The :attribute format is invalid.',
|
||||
'required' => 'The :attribute field is required.',
|
||||
'required_if' => 'The :attribute field is required when :other is :value.',
|
||||
'required_unless' => 'The :attribute field is required unless :other is in :values.',
|
||||
'required_with' => 'The :attribute field is required when :values is present.',
|
||||
'required_with_all' => 'The :attribute field is required when :values is present.',
|
||||
'required_without' => 'The :attribute field is required when :values is not present.',
|
||||
'required_without_all' => 'The :attribute field is required when none of :values are present.',
|
||||
'same' => 'The :attribute and :other must match.',
|
||||
'size' => [
|
||||
'numeric' => 'The :attribute must be :size.',
|
||||
'file' => 'The :attribute must be :size kilobytes.',
|
||||
'string' => 'The :attribute must be :size characters.',
|
||||
'array' => 'The :attribute must contain :size items.',
|
||||
'not_in' => 'The selected :attribute is invalid',
|
||||
'numeric' => 'The :attribute must be a number',
|
||||
'present' => 'The :attribute field must be present',
|
||||
'regex' => 'The :attribute format is invalid',
|
||||
'required' => 'The :attribute field is required',
|
||||
'required_if' => 'The :attribute field is required when :other is :value',
|
||||
'required_unless' => 'The :attribute field is required unless :other is in :values',
|
||||
'required_with' => 'The :attribute field is required when :values is present',
|
||||
'required_with_all' => 'The :attribute field is required when :values is present',
|
||||
'required_without' => 'The :attribute field is required when :values is not present',
|
||||
'required_without_all' => 'The :attribute field is required when none of :values are present',
|
||||
'same' => 'The :attribute and :other must match',
|
||||
'size' => [
|
||||
'numeric' => 'The :attribute must be :size',
|
||||
'file' => 'The :attribute must be :size kilobytes',
|
||||
'string' => 'The :attribute must be :size characters',
|
||||
'array' => 'The :attribute must contain :size items',
|
||||
],
|
||||
'string' => 'The :attribute must be a string.',
|
||||
'timezone' => 'The :attribute must be a valid zone.',
|
||||
'unique' => 'The :attribute has already been taken.',
|
||||
'uploaded' => 'The :attribute failed to upload.',
|
||||
'url' => 'The :attribute format is invalid.',
|
||||
'string' => 'The :attribute must be a string',
|
||||
'timezone' => 'The :attribute must be a valid zone',
|
||||
'unique' => 'The :attribute has already been taken',
|
||||
'uploaded' => 'The :attribute failed to upload',
|
||||
'url' => 'The :attribute format is invalid',
|
||||
];
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
"Modules\\Core\\Providers\\CoreServiceProvider",
|
||||
"Modules\\Core\\Providers\\ModuleServiceProvider",
|
||||
"Modules\\Core\\Providers\\ThemeServiceProvider",
|
||||
"Modules\\Core\\Providers\\AssetServiceProvider",
|
||||
"Modules\\Core\\Providers\\SearchEngineServiceProvider",
|
||||
"Modules\\Core\\Providers\\RouteServiceProvider"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user