osb/app/Traits/ProviderRef.php

18 lines
315 B
PHP

<?php
/**
* Get a provider reference ID
*/
namespace App\Traits;
use App\Models\ProviderOauth;
trait ProviderRef
{
public function provider_ref(ProviderOauth $poo): ?string
{
return (($x=$this->providers->where('pivot.provider_oauth_id',$poo->id))->count() === 1)
? $x->pop()->pivot->ref
: NULL;
}
}