You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
793 B

<?php
namespace App;
use Movim\Model;
class Identity extends Model
{
public $primaryKey = ['info_id', 'category', 'type'];
public $incrementing = false;
public function info()
{
return $this->belongsTo(Info::class);
}
public static function saveMany($identities)
{
if ($identities->isNotEmpty()) {
Identity::upsert($identities->map(function (Identity $identity) {
return [
'info_id' => $identity->info_id,
'category' => $identity->category,
'type' => $identity->type,
'lang' => $identity->lang,
'name' => $identity->name
];
})->all(), $identities->first()->primaryKey);
}
}
}