46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Actions\Grid;
|
|
|
|
use Dcat\Admin\Actions\Response;
|
|
use Dcat\Admin\Grid\RowAction;
|
|
use Dcat\Admin\Traits\HasPermissions;
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ArticleList extends RowAction
|
|
{
|
|
public function title()
|
|
{
|
|
if ($this->title) {
|
|
return $this->title;
|
|
}
|
|
return '<i class="feather grid-action-icon icon-list"></i> '.__('admin.list').' ';
|
|
}
|
|
|
|
/**
|
|
* @param Model|Authenticatable|HasPermissions|null $user
|
|
*
|
|
* @return bool
|
|
*/
|
|
protected function authorize($user): bool
|
|
{
|
|
return $user->can('dcat.admin.articles.index');
|
|
}
|
|
|
|
/**
|
|
* Handle the action request.
|
|
*
|
|
* @param Request $request
|
|
*
|
|
* @return Response
|
|
*/
|
|
public function handle(Request $request)
|
|
{
|
|
return $this->response()
|
|
// ->success('Processed successfully: '.$this->getKey())
|
|
->redirect(admin_route('articles.index', ['category' =>$this->getKey()]));
|
|
}
|
|
}
|