forked from laravel/scout
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce621be
commit da88070
Showing
4 changed files
with
109 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Laravel\Scout\Jobs; | ||
|
||
use Laravel\Scout\Searchable; | ||
use Illuminate\Database\Eloquent\Collection; | ||
|
||
class RemoveableScoutCollection extends Collection | ||
{ | ||
/** | ||
* Get the Scout identifiers for all of the entities. | ||
* | ||
* @return array | ||
*/ | ||
public function getQueueableIds() | ||
{ | ||
if ($this->isEmpty()) { | ||
return []; | ||
} | ||
|
||
return in_array(Searchable::class, class_uses_recursive($this->first())) | ||
? $this->map->getScoutKey()->all() | ||
: parent::getQueueableIds(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Laravel\Scout\Tests\Fixtures; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Laravel\Scout\Searchable; | ||
|
||
class SearchableModelWithCustomKey extends Model | ||
{ | ||
use Searchable; | ||
|
||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = ['other_id']; | ||
|
||
public function getScoutKey() | ||
{ | ||
return $this->other_id; | ||
} | ||
|
||
public function getScoutKeyName() | ||
{ | ||
return $this->qualifyColumn('other_id'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters