FEATURE: add permissions into widgets and fix few bugs

This commit is contained in:
Michal Kváček
2017-08-24 01:54:58 +02:00
parent e0f5cba9a4
commit b35149ad67
23 changed files with 239 additions and 110 deletions
+9 -1
View File
@@ -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)