OK、読んで、メソッドと変数の PHP レイト スタティック バインディングについてある程度理解していると感じました。しかし、 Laravel 5 のこのコードの 28 行目からwhereIn
、Laravel Collection メソッドであるwith を使用します。ここで何が起こっているのかわかりませんstatic::whereIn()
。使用できるように、コレクションはどこにありますかwhereIn()
。
/**
* Add any tags needed from the list
*
* @param array $tags List of tags to check/add
*/
public static function addNeededTags(array $tags)
{
if (count($tags) === 0) {
return;
}
$found = static::whereIn('tag', $tags)->lists('tag')->all();
foreach (array_diff($tags, $found) as $tag) {
static::create([
'tag' => $tag,
'title' => $tag,
'subtitle' => 'Subtitle for '.$tag,
'page_image' => '',
'meta_description' => '',
'reverse_direction' => false,
]);
}
}