32 lines
578 B
PHP
32 lines
578 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Plantel;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
class Prospecto extends Model
|
|
{
|
|
protected $guarded = [];
|
|
|
|
|
|
public function plantelUsuarios(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Plantel::class);
|
|
}
|
|
|
|
public function existe($plantelId): bool
|
|
{
|
|
return $this->plantelUsuarios()
|
|
->where('plantels.id', $plantelId)
|
|
->exists();
|
|
}
|
|
|
|
public function prospectos() : BelongsToMany
|
|
{
|
|
return $this->belongsToMany(User::class);
|
|
}
|
|
|
|
}
|