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.
 
 
 
 

29 lines
699 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('App\Info');
}
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,
];
})->all(), $identities->first()->primaryKey);
}
}
}