File: /home/richfield/www/vendor/tcg/voyager/src/Widgets/PageDimmer.php
<?php
namespace TCG\Voyager\Widgets;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
use TCG\Voyager\Facades\Voyager;
class PageDimmer extends BaseDimmer
{
/**
* The configuration array.
*
* @var array
*/
protected $config = [];
/**
* Treat this method as a controller action.
* Return view() or other content to display.
*/
public function run()
{
$count = Voyager::model('Page')->count();
$string = trans_choice('voyager::dimmer.page', $count);
return view('voyager::dimmer', array_merge($this->config, [
'icon' => 'voyager-file-text',
'title' => "{$count} {$string}",
'text' => __('voyager::dimmer.page_text', ['count' => $count, 'string' => Str::lower($string)]),
'button' => [
'text' => __('voyager::dimmer.page_link_text'),
'link' => route('voyager.pages.index'),
],
'image' => voyager_asset('images/widget-backgrounds/03.jpg'),
]));
}
/**
* Determine if the widget should be displayed.
*
* @return bool
*/
public function shouldBeDisplayed()
{
return Auth::user()->can('browse', Voyager::model('Page'));
}
}