FEATURE: add permissions into widgets and fix few bugs
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\CMS\Handlers\Search;
|
||||
|
||||
use App\Models\Content\Content as ContentModel;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class Content extends Search
|
||||
{
|
||||
@@ -10,10 +13,15 @@ class Content extends Search
|
||||
*
|
||||
* @param string $term searched word
|
||||
*
|
||||
* @return array list of found objects
|
||||
* @return array|\Illuminate\Database\Eloquent\Collection|Collection|static[]
|
||||
*/
|
||||
public function search($term)
|
||||
{
|
||||
if (Auth::user()
|
||||
->cannot('manage', ContentModel::class)) {
|
||||
return new Collection();
|
||||
}
|
||||
|
||||
$token = $this->tokenize($term);
|
||||
|
||||
return ContentModel::where('pageContent', 'LIKE', $token)
|
||||
|
||||
Reference in New Issue
Block a user