FEATURE: register file searching

This commit is contained in:
Michal Kváček
2016-03-15 14:00:53 +01:00
parent b3da43921b
commit 6f50549072
4 changed files with 63 additions and 4 deletions
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App\Handlers\Search;
use App\Models\File;
class Files extends Search
{
public function getId()
{
return "files";
}
public function getName()
{
return trans('search.files');
}
/**
* Search for given patttern/term
*
* @param string $term searched word
*
* @return array list of found objects
*/
public function search($term)
{
$token = $this->tokenize($term);
return File::where('original_filename', 'LIKE', $token)
->orWhere('keywords', 'LIKE', $token)
->orWhere('description', 'LIKE', $token)
->orWhere('mime_type', 'LIKE', $token)
->get();
}
}