Example #1
0
 /**
  * __construct
  *
  * @param GroupInterface $group
  * @param GroupForm     $groupForm
  */
 public function __construct(GroupInterface $group, GroupForm $groupForm)
 {
     parent::__construct($group, $groupForm);
     $this->title['parent'] = trans_choice('groups::global.groups', 2);
     // Establish Filters
     $this->beforeFilter('inGroup:Admins');
 }
 /**
  * translate given message with laravel trans function
  *
  * @param string $id
  * @param array $parameters
  * @param integer|null $count
  * @return string
  */
 function lmcTrans($id, $parameters = [], $count = null)
 {
     if (is_integer($count)) {
         return trans_choice('laravel-modules-core::' . $id, $count, $parameters);
     }
     return trans('laravel-modules-core::' . $id, $parameters);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postAdd(Request $request, $product_id)
 {
     $deal = Deal::firstOrCreate(['user_id' => $request->user()->id, 'product_id' => $product_id]);
     $product = \App\Product::find($product_id);
     $request->session()->put("deals.{$product_id}", $product);
     return response()->json(['id' => $product_id, 'mobile' => trans('products.mobile', ['mobile' => $request->user()->mobile]), 'text' => trans_choice('products.deal', $product->deals_count)]);
 }
 public function testPluralsOffset()
 {
     $this->assertEquals('You do not like this yet', trans_choice('test::test.offset', 0));
     $this->assertEquals('You liked this', trans_choice('test::test.offset', 1));
     $this->assertEquals('You and one other person liked this', trans_choice('test::test.offset', 2));
     $this->assertEquals('You and 2 others liked this', trans_choice('test::test.offset', 3));
 }
Example #5
0
function duration_human($minutes, $output = 'days,hours,minutes', $short = false, $separator = ', ')
{
    $format = function ($value, $unit, $short) {
        $unitString = trans_choice("time.{$unit}", $value);
        return sprintf('<strong>%d</strong>%s', $value, $short ? $unitString[0] : " {$unitString}");
    };
    $strings = [];
    if ($short && $separator == ', ') {
        $separator = ' ';
    }
    $timespan = timespan(time() + $minutes * 60, time(), $output);
    foreach (array_filter($timespan) as $unit => $value) {
        $strings[] = $format($value, $unit, $short);
    }
    if (empty($strings)) {
        end($timespan);
        $unit = key($timespan);
        $strings[] = $format($timespan[$unit], $unit, $short);
    }
    $last = array_pop($strings);
    $count = count($strings);
    if ($count && $short) {
        return sprintf('%s%s%s', implode($separator, $strings), $separator, $last);
    } elseif ($count) {
        return sprintf('%s %s %s', implode($separator, $strings), trans('and'), $last);
    } else {
        return $last;
    }
}
Example #6
0
 /**
  * Bind data to the view.
  *
  * @param  View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     // Home. This menu item declares the menu and
     // sets it as an array of arrays.
     $menu = [['name' => trans('web::seat.home'), 'icon' => 'fa-home', 'route_segment' => 'home', 'route' => 'home']];
     // Key Management
     array_push($menu, ['name' => trans('web::seat.api_key_management'), 'icon' => 'fa-key', 'route_segment' => 'api-key', 'entries' => [['name' => trans('web::seat.add_api_key'), 'icon' => 'fa-plus', 'route' => 'api.key'], ['name' => trans('web::seat.list_keys'), 'icon' => 'fa-list', 'route' => 'api.key.list']]]);
     // Corporation
     array_push($menu, ['name' => trans_choice('web::seat.corporation', 2), 'icon' => 'fa-building', 'route_segment' => 'corporation', 'entries' => [['name' => trans('web::seat.all_corp'), 'icon' => 'fa-group', 'route' => 'corporation.list']]]);
     // Character
     array_push($menu, ['name' => trans_choice('web::seat.character', 2), 'icon' => 'fa-user', 'route_segment' => 'character', 'entries' => [['name' => trans('web::seat.all_char'), 'icon' => 'fa-group', 'route' => 'character.list'], ['name' => trans('web::seat.mail_timeline'), 'icon' => 'fa-envelope', 'route' => 'character.view.mail.timeline']]]);
     // Configuration
     if (auth()->user()->hasSuperuser()) {
         array_push($menu, ['name' => trans('web::seat.configuration'), 'icon' => 'fa-cogs', 'route_segment' => 'configuration', 'entries' => [['name' => trans('web::seat.access'), 'icon' => 'fa-shield', 'route' => 'configuration.access.roles'], ['name' => trans('web::seat.import'), 'icon' => 'fa-upload', 'route' => 'configuration.import.list'], ['name' => trans_choice('web::seat.user', 2), 'icon' => 'fa-user', 'route' => 'configuration.users'], ['name' => trans('web::seat.schedule'), 'icon' => 'fa-clock-o', 'route' => 'configuration.schedule'], ['name' => trans('web::seat.settings'), 'icon' => 'fa-cog', 'route' => 'seat.settings.view'], ['name' => trans('web::seat.security_logs'), 'icon' => 'fa-list', 'route' => 'configuration.security.logs']]]);
     }
     // Load any menus from any registered packages
     $package_menus = config('package.sidebar');
     foreach ($package_menus as $package_name => $menu_data) {
         $prepared_menu = $this->load_plugin_menu($package_name, $menu_data);
         if (!empty($prepared_menu)) {
             array_push($menu, $prepared_menu);
         }
     }
     array_push($menu, ['name' => trans('web::seat.other'), 'icon' => 'fa-circle', 'route_segment' => 'other']);
     $view->with('menu', $menu);
 }
Example #7
0
 /**
  * Index page view composer.
  *
  * @param \Illuminate\Contracts\View\View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     $totalComponents = Component::enabled()->count();
     $majorOutages = Component::enabled()->status(4)->count();
     $isMajorOutage = $majorOutages / $totalComponents >= 0.5;
     // Default data
     $withData = ['system_status' => 'info', 'system_message' => trans_choice('cachet.service.bad', $totalComponents), 'favicon' => 'favicon-high-alert'];
     if ($isMajorOutage) {
         $withData = ['system_status' => 'danger', 'system_message' => trans_choice('cachet.service.major', $totalComponents), 'favicon' => 'favicon-high-alert'];
     } elseif (Component::enabled()->notStatus(1)->count() === 0) {
         // If all our components are ok, do we have any non-fixed incidents?
         $incidents = Incident::notScheduled()->orderBy('created_at', 'desc')->get();
         $incidentCount = $incidents->count();
         if ($incidentCount === 0 || $incidentCount >= 1 && (int) $incidents->first()->status === 4) {
             $withData = ['system_status' => 'success', 'system_message' => trans_choice('cachet.service.good', $totalComponents), 'favicon' => 'favicon'];
         }
     } else {
         if (Component::enabled()->whereIn('status', [2, 3])->count() > 0) {
             $withData['favicon'] = 'favicon-medium-alert';
         }
     }
     // Scheduled maintenance code.
     $scheduledMaintenance = Incident::scheduled()->orderBy('scheduled_at')->get();
     // Component & Component Group lists.
     $usedComponentGroups = Component::enabled()->where('group_id', '>', 0)->groupBy('group_id')->pluck('group_id');
     $componentGroups = ComponentGroup::whereIn('id', $usedComponentGroups)->orderBy('order')->get();
     $ungroupedComponents = Component::enabled()->where('group_id', 0)->orderBy('order')->orderBy('created_at')->get();
     $view->with($withData)->withComponentGroups($componentGroups)->withUngroupedComponents($ungroupedComponents)->withScheduledMaintenance($scheduledMaintenance);
 }
Example #8
0
 public function toArray()
 {
     $data = parent::toArray();
     if (!empty($data['photos'])) {
         $data['photos'] = $this->processPhotos($data['photos']);
     }
     $data['age'] = false;
     if (!empty($data['bdate'])) {
         $bdate = explode('.', $data['bdate']);
         if (count($bdate) >= 3) {
             $bdate = new \DateTime($bdate[2] . '-' . $bdate[1] . '-' . $bdate[0]);
             $now = new \DateTime();
             $diff = $now->diff($bdate);
             $year = $diff->y;
             $age = trans_choice('main.age', $year, [], 'message', 'ru');
             $data['age'] = $age;
         }
     }
     if ($data['age'] == false) {
         $year = rand(18, 25);
         $age = trans_choice('main.age', $year, [], 'message', 'ru');
         $data['age'] = $age;
     }
     return $data;
 }
Example #9
0
 public function editCustomRecord($parameters)
 {
     $parameters['models'] = array_map(function ($object) {
         $object->name = trans_choice($object->name, 1);
         return $object;
     }, config('booking.models'));
     return $parameters;
 }
 public function getList(Request $request)
 {
     $justAddedCustomerContact = false;
     if ($request->session()->get('customer.justaddedcustomer_contact')) {
         $justAddedCustomerContact = true;
         $request->session()->forget('customer.justaddedcustomer_contact');
     }
     return view('website.customer.customer_contacts.list')->with(['browserTitle' => trans_choice('customer_contact.customer_contact', 2), 'mainArea' => 'customer_contacts', 'subArea' => 'list', 'justAddedCustomerContact' => $justAddedCustomerContact, 'customer' => $this->customer->getByToken()]);
 }
 public function getList(Request $request)
 {
     $justAddedProducer = false;
     if ($request->session()->get('customer.justaddedproducer')) {
         $justAddedProducer = true;
         $request->session()->forget('customer.justaddedproducer');
     }
     return view('website.customer.producers.list')->with(['browserTitle' => trans_choice('producer.producer', 2), 'mainArea' => 'producers', 'subArea' => 'list', 'justAddedProducer' => $justAddedProducer, 'customer' => $this->customer->getByToken()]);
 }
Example #12
0
 public function getTasters(Request $request)
 {
     $justAddedTaster = false;
     if ($request->session()->get('user.justaddedtaster')) {
         $justAddedTaster = true;
         $request->session()->forget('user.justaddedtaster');
     }
     return view('website.user.tasters.list')->with(['browserTitle' => trans_choice('taster.taster', 2), 'mainArea' => 'tasters', 'subArea' => 'list', 'justAddedTaster' => $justAddedTaster, 'user' => $this->user->getByToken()]);
 }
Example #13
0
 public function customIndex($parameters)
 {
     if (isset($parameters['modal']) && $parameters['modal'] == 1) {
         $this->viewParameters['deleteSelectButton'] = false;
     }
     $shop = Shop::builder()->find($parameters['ref']);
     $customer = $shop->getCustomer;
     $parameters['customTransHeader'] = trans_choice('pulsar::pulsar.address', 1) . ' ' . trans('pulsar::pulsar.from') . ' ' . $shop->name_076 . ' (' . $customer->code_075 . ' - ' . $customer->company_name_075 . ')';
     return $parameters;
 }
Example #14
0
 /**
  * Process request to send signup email
  * @param  App\Http\Requests\Auth\SignupEmail $request
  * @param  App\Services\EmailInteractionLimiter $limiter
  * @return Illuminate\Http\RedirectResponse
  */
 public function postSignupEmail(SignupEmail $request, EmailInteractionLimiter $limiter)
 {
     if ($limiter->allowed('signup')) {
         $this->dispatch(new SendSignupEmail($request->email));
         return back()->withInfo('An email will be sent to ' . $request->email . '. Please, follow the provided link to finish signup procedure.');
     } else {
         $expire = config('auth.email_lockout');
         return back()->withDanger(trans_choice('auth.lockout', $expire, compact('expire')));
     }
 }
Example #15
0
 /**
  * Send email with password reset link to requested address
  *
  * @param  App\Http\Requests\Auth\PasswordEmail $request
  * @param  App\Services\EmailInteractionLimiter $limiter
  * @return Illuminate\Http\RedirectResponse
  */
 public function postEmail(PasswordEmail $request, EmailInteractionLimiter $limiter)
 {
     if ($limiter->allowed('passreset')) {
         $this->dispatch(new SendPasswordResetEmail($request->email));
         return back()->withInfo('An email will be sent to ' . $request->email . '. Please, follow the provided link to change your password.');
     } else {
         $expire = config('auth.email_lockout');
         return back()->withDanger(trans_choice('auth.lockout', $expire, compact('expire')));
     }
 }
Example #16
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof ResourceNotFoundException) {
         return ApiResponse::resourceNotFound(trans_choice('messages.resource.empty', 1, ['resource' => $e->resource]));
     } elseif ($e instanceof NoResourceFoundException) {
         return ApiResponse::resourceNotFound(trans_choice('messages.resource.empty', 2, ['resource' => $e->resource]));
     } elseif ($e instanceof ForbiddenException) {
         return ApiResponse::forbidden(trans('messages.forbidden'));
     }
     return parent::render($request, $e);
 }
 /**
  * Translates the given message based on a count.
  * The count will be calculated according configured rule.
  *
  * @param string        $id
  * @param int           $number
  * @param array         $parameters
  * @param string        $domain
  * @param string|null   $locale
  * @param callable|null $rule
  *
  * @return string
  */
 function trans_rule($id, $number, array $parameters = [], $domain = 'messages', $locale = null, callable $rule = null)
 {
     if (!is_callable($rule)) {
         $locale = $locale ?: app()->getLocale();
         $rule = app('translation.rules')->get($locale);
     }
     if (is_callable($rule)) {
         $number = $rule($number);
     }
     return trans_choice($id, $number, $parameters, $domain, $locale);
 }
Example #18
0
 public function update($id, $data)
 {
     $resource = $this->repository->find($id);
     if (!$resource) {
         throw new ResourceNotFoundException(trans_choice('messages.resource.empty', 1, ['resource' => $this->repository->resource]));
     }
     if (!$resource->update($data)) {
         return ApiResponse::badRequest(trans('messages.resource.update.failed', ['resource' => $this->repository->resource]));
     }
     return ApiResponse::responseData($resource, trans('messages.resource.update.success', ['resource' => $this->repository->resource]));
 }
Example #19
0
 public function showCustomRecord($parameters)
 {
     // types
     $parameters['types'] = array_map(function ($object) {
         $object->name = trans_choice($object->name, 1);
         return $object;
     }, config('projects.types'));
     // projects
     $parameters['projects'] = Project::builder()->get();
     return $parameters;
 }
 public function showCustomRecord($parameters)
 {
     $parameters['ruleFamilies'] = array_map(function ($object) {
         $object->name = trans_choice($object->name, 1);
         return $object;
     }, config('market.ruleFamilies'));
     $parameters['discountTypes'] = array_map(function ($object) {
         $object->name = trans($object->name);
         return $object;
     }, config('market.discountTypes'));
     return $parameters;
 }
 public function getList(Request $request, SettingRepository $settings)
 {
     $justAddedSample = false;
     $justAddedSampleText = '';
     if ($request->session()->get('customer.justaddedsample')) {
         $setting = $settings->getBySlug('info_sample_submission');
         $justAddedSampleText = $setting->text;
         $justAddedSample = true;
         $request->session()->forget('customer.justaddedsample');
     }
     return view('website.customer.samples.list')->with(['browserTitle' => trans_choice('sample.sample', 2), 'mainArea' => 'samples', 'subArea' => 'list', 'justAddedSample' => $justAddedSample, 'justAddedSampleText' => $justAddedSampleText, 'customer' => $this->customer->getByToken()]);
 }
Example #22
0
function product_quantity_options($product)
{
    if ($product->stock === null) {
        $max = $product->max_quantity;
    } else {
        $max = min($product->max_quantity, $product->stock);
    }
    $opts = [];
    for ($i = 1; $i <= $max; $i++) {
        $opts[$i] = trans_choice('common.count.item', $i);
    }
    return $opts;
}
Example #23
0
 /**
  * [postEmail description]
  * @param  App\Http\Requests\Auth\ChangeEmail   $request
  * @param  App\Services\EmailInteractionLimiter $limiter
  * @return Illuminate\Http\RedirectResponse
  */
 public function postEmail(ChangeEmail $request, EmailInteractionLimiter $limiter)
 {
     $valid = Hash::check($request->password_current, auth()->user()->password);
     if (!$valid) {
         return back()->withDanger('Incorrect current password');
     }
     if ($limiter->allowed('changemail')) {
         $this->dispatch(new SendEmailConfirmation($request->email));
         return back()->withInfo('An email will be sent to ' . $request->email . '. Please, follow the provided link to confirm your new email.');
     } else {
         $expire = config('auth.email_lockout');
         return back()->withDanger(trans_choice('auth.lockout', $expire, compact('expire')));
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store($post_id)
 {
     $favorite = $this->favorite->wherePostId($post_id)->whereUserId(Auth::id());
     if ($favorite->exists()) {
         $favorite->first()->delete();
     } else {
         if ($favorite->withTrashed()->exists()) {
             $favorite->first()->restore();
         } else {
             $this->favorite->create(['post_id' => $post_id, 'user_id' => Auth::id()]);
         }
     }
     $post = \App\Post::find($post_id);
     $text = trans_choice('favorites.post', $post->favorites_count, ['count' => $post->favorites_count]);
     return response()->json(['post_id' => $post_id, 'text' => $text]);
 }
 /**
  * Register routes, translations, views and publishers.
  *
  * @return void
  */
 public function boot()
 {
     $this->loadTranslationsFrom(realpath(__DIR__ . '/../Resources/Lang'), 'l5cp-user');
     $submenu = [['nav' => 'main', 'sort' => '1', 'link' => url('/admin/users/create'), 'title' => trans('lcp::button.create')], ['nav' => 'main', 'sort' => '1', 'link' => url('/admin/roles'), 'title' => trans_choice('l5cp-user::default.role', 2)], ['nav' => 'main', 'sort' => '1', 'link' => url('/admin/permissions'), 'title' => trans_choice('l5cp-user::default.permission', 2)]];
     NavigationHelper::Add(['nav' => 'main', 'sort' => '1', 'link' => url('/admin/users'), 'title' => trans_choice('l5cp-user::default.user', 2), 'icon' => 'fa-users', 'submenu' => $submenu]);
     HookHelper::Add(['hook' => 'dashboard', 'template' => 'l5cp-user::dashboard.welcome', 'sort' => '1']);
     SearchHelper::Add(['model' => 'Askedio\\Laravelcp\\Models\\User', 'name' => 'User', 'var' => 'user', 'columns' => ['email', 'name', 'id'], 'actions' => ['id' => ['method' => 'link', 'action' => '/admin/users/?/edit']]]);
     if (!$this->app->routesAreCached()) {
         require realpath(__DIR__ . '/../Http/routes.php');
     }
     $this->loadViewsFrom(realpath(__DIR__ . '/../Resources/Views'), 'l5cp-user');
     $this->publishes([realpath(__DIR__ . '/../Resources/Views') => base_path('resources/views/vendor/askedio/laravelcp')], 'views');
     $this->publishes([realpath(__DIR__ . '/../Resources/Assets') => public_path('assets')], 'public');
     $this->publishes([realpath(__DIR__ . '/../Resources/Config') => config_path('')], 'config');
     $this->publishes([realpath(__DIR__ . '/../Database/Migrations') => database_path('migrations')], 'migrations');
     $this->publishes([realpath(__DIR__ . '/../Database/Seeds') => database_path('seeds')], 'seeds');
 }
Example #26
0
 public function destroy($id)
 {
     $count = 1;
     $messages = new MessageBag();
     $class = $this->model;
     if (\Input::has('remove_ids')) {
         $id = \Input::get('remove_ids');
         $count = count($id);
     }
     if ($class::destroy($id)) {
         $messages->add('success', trans_choice($this->getTranslationNamespace() . '.destroy_success', $count));
         return \Redirect::route($this->resource . '.index')->with('messages', $messages);
     } else {
         $messages->add('danger', trans_choice($this->getTranslationNamespace() . '.destroy_error', $count));
         return \Redirect::back()->withInput()->with('messages', $messages);
     }
 }
Example #27
0
 /**
  * Bind data to the view.
  *
  * @param  View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     // This menu item declares the menu and
     // sets it as an array of arrays.
     $menu = [['name' => trans('web::seat.assets'), 'permission' => 'corporation.assets', 'highlight_view' => 'assets', 'route' => 'corporation.view.assets'], ['name' => trans_choice('web::seat.bookmark', 2), 'permission' => 'corporation.bookmarks', 'highlight_view' => 'bookmarks', 'route' => 'corporation.view.bookmarks'], ['name' => trans('web::seat.contacts'), 'permission' => 'corporation.contacts', 'highlight_view' => 'contacts', 'route' => 'corporation.view.contacts'], ['name' => trans('web::seat.contracts'), 'permission' => 'corporation.contracts', 'highlight_view' => 'contracts', 'route' => 'corporation.view.contracts'], ['name' => trans('web::seat.industry'), 'permission' => 'corporation.industry', 'highlight_view' => 'industry', 'route' => 'corporation.view.industry'], ['name' => trans('web::seat.killmails'), 'permission' => 'corporation.killmails', 'highlight_view' => 'killmails', 'route' => 'corporation.view.killmails'], ['name' => trans('web::seat.market'), 'permission' => 'corporation.market', 'highlight_view' => 'market', 'route' => 'corporation.view.market'], ['name' => trans('web::seat.pocos'), 'permission' => 'corporation.pocos', 'highlight_view' => 'pocos', 'route' => 'corporation.view.pocos'], ['name' => trans('web::seat.security'), 'permission' => 'corporation.security', 'highlight_view' => 'security', 'route' => 'corporation.view.security.roles'], ['name' => trans_choice('web::seat.starbase', 2), 'permission' => 'corporation.starbases', 'highlight_view' => 'starbases', 'route' => 'corporation.view.starbases'], ['name' => trans('web::seat.summary'), 'permission' => 'corporation.summary', 'highlight_view' => 'summary', 'route' => 'corporation.view.summary'], ['name' => trans('web::seat.standings'), 'permission' => 'corporation.standings', 'highlight_view' => 'standings', 'route' => 'corporation.view.standings'], ['name' => trans('web::seat.tracking'), 'permission' => 'corporation.tracking', 'highlight_view' => 'tracking', 'route' => 'corporation.view.tracking'], ['name' => trans('web::seat.wallet_journal'), 'permission' => 'corporation.journal', 'highlight_view' => 'journal', 'route' => 'corporation.view.journal'], ['name' => trans('web::seat.wallet_transactions'), 'permission' => 'corporation.transactions', 'highlight_view' => 'transactions', 'route' => 'corporation.view.transactions']];
     // Load any package menus
     if (!empty(config('package.corporation.menu'))) {
         foreach (config('package.corporation.menu') as $menu_data) {
             $prepared_menu = $this->load_plugin_menu($menu_data);
             array_push($menu, $prepared_menu);
         }
     }
     // Sort the menu alphabetically.
     $menu = array_values(array_sort($menu, function ($value) {
         return $value['name'];
     }));
     $view->with('menu', $menu);
 }
Example #28
0
 /**
  * Bind data to the view.
  *
  * @param  View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     // This menu item declares the menu and
     // sets it as an array of arrays.
     $menu = [['name' => trans('web::seat.assets'), 'permission' => 'character.assets', 'highlight_view' => 'assets', 'route' => 'character.view.assets'], ['name' => trans_choice('web::seat.bookmark', 2), 'permission' => 'character.bookmarks', 'highlight_view' => 'bookmarks', 'route' => 'character.view.bookmarks'], ['name' => trans('web::seat.calendar'), 'permission' => 'character.calendar', 'highlight_view' => 'calendar', 'route' => 'character.view.calendar'], ['name' => trans('web::seat.channels'), 'permission' => 'character.channels', 'highlight_view' => 'channels', 'route' => 'character.view.channels'], ['name' => trans('web::seat.contacts'), 'permission' => 'character.contacts', 'highlight_view' => 'contacts', 'route' => 'character.view.contacts'], ['name' => trans('web::seat.contracts'), 'permission' => 'character.contracts', 'highlight_view' => 'contracts', 'route' => 'character.view.contracts'], ['name' => trans('web::seat.industry'), 'permission' => 'character.industry', 'highlight_view' => 'industry', 'route' => 'character.view.industry'], ['name' => trans('web::seat.killmails'), 'permission' => 'character.killmails', 'highlight_view' => 'killmails', 'route' => 'character.view.killmails'], ['name' => trans('web::seat.mail'), 'permission' => 'character.mail', 'highlight_view' => 'mail', 'route' => 'character.view.mail'], ['name' => trans('web::seat.market'), 'permission' => 'character.market', 'highlight_view' => 'market', 'route' => 'character.view.market'], ['name' => trans('web::seat.notifications'), 'permission' => 'character.notifications', 'highlight_view' => 'notifications', 'route' => 'character.view.notifications'], ['name' => trans('web::seat.pi'), 'permission' => 'character.pi', 'highlight_view' => 'pi', 'route' => 'character.view.pi'], ['name' => trans('web::seat.research'), 'permission' => 'character.research', 'highlight_view' => 'research', 'route' => 'character.view.research'], ['name' => trans('web::seat.sheet'), 'permission' => 'character.sheet', 'highlight_view' => 'sheet', 'route' => 'character.view.sheet'], ['name' => trans('web::seat.skills'), 'permission' => 'character.skills', 'highlight_view' => 'skills', 'route' => 'character.view.skills'], ['name' => trans('web::seat.standings'), 'permission' => 'character.standings', 'highlight_view' => 'standings', 'route' => 'character.view.standings'], ['name' => trans('web::seat.wallet_journal'), 'permission' => 'character.journal', 'highlight_view' => 'journal', 'route' => 'character.view.journal'], ['name' => trans('web::seat.wallet_transactions'), 'permission' => 'character.transactions', 'highlight_view' => 'transactions', 'route' => 'character.view.transactions']];
     // Load any package menus
     if (!empty(config('package.character.menu'))) {
         foreach (config('package.character.menu') as $menu_data) {
             $prepared_menu = $this->load_plugin_menu($menu_data);
             array_push($menu, $prepared_menu);
         }
     }
     // Sort the menu alphabetically.
     $menu = array_values(array_sort($menu, function ($value) {
         return $value['name'];
     }));
     $view->with('menu', $menu);
 }
Example #29
0
 /**
  * Get thread title.
  *
  * IMPORTANT: participants.user relation
  * must be loaded when working with
  * multiple results!
  *
  * @return string
  */
 public function getTitleAttribute()
 {
     if (!$this->relationLoaded('participants')) {
         $this->load('participants.user');
     }
     $excludeUser = $this->relationLoaded('pivot') ? $this->pivot->user_id : null;
     $participants = [];
     $numberOfParticipants = 0;
     foreach ($this->participants as $participant) {
         // Exclude creator...
         if ($excludeUser and $participant->user_id == $excludeUser) {
             continue;
         }
         $participants[] = $participant->user->name;
         ++$numberOfParticipants;
     }
     return trans_choice('messenger::messenger.threads.title', $numberOfParticipants, ['name' => $participants[0], 'count' => $numberOfParticipants - 1]);
 }
Example #30
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(PermissionRequest $request)
 {
     $arrayPermissionRoleMapping = $request->permissionRoles;
     $permissions = Permission::all();
     $roles = Role::all();
     foreach ($permissions as $permissionkey => $permission) {
         foreach ($roles as $roleKey => $role) {
             //If checkbox is clicked attach the permission
             if (!empty($arrayPermissionRoleMapping[$permissionkey][$roleKey])) {
                 // check that this permission has not already been attached to a role before attempting it again!
                 if (!$role->perms->find($permission->id)) {
                     $role->attachPermission($permission);
                 }
             } elseif (empty($arrayPermissionRoleMapping[$permissionkey][$roleKey])) {
                 $role->detachPermission($permission);
             }
         }
     }
     return redirect()->to('permission.index')->with('message', trans_choice('messages.record-successfully-saved', 1))->with('active_permission', $permission->id);
 }