%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : addictionfreeind ( 1003) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Directory : /home/addictionfreeind/www/admin1/app/Models/ |
Upload File : |
<?php
namespace App\Models;
use App\Scopes\ActiveScope;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Notifications\Notifiable;
/**
* App\Models\ProjectTemplateMember
*
* @property int $id
* @property int $user_id
* @property int $project_template_id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read mixed $icon
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
* @property-read int|null $notifications_count
* @property-read \App\Models\ProjectTemplate $projectTemplate
* @property-read \App\Models\User $user
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTemplateMember newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTemplateMember newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTemplateMember query()
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTemplateMember whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTemplateMember whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTemplateMember whereProjectTemplateId($value)
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTemplateMember whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTemplateMember whereUserId($value)
* @mixin \Eloquent
*/
class ProjectTemplateMember extends BaseModel
{
use Notifiable;
protected $with = ['user'];
public function routeNotificationForMail()
{
return $this->user->email;
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id')->withoutGlobalScope(ActiveScope::class);
}
public function projectTemplate(): BelongsTo
{
return $this->belongsTo(ProjectTemplate::class);
}
public static function byProject($id)
{
return ProjectTemplateMember::join('users', 'users.id', '=', 'project_template_members.user_id')
->where('project_template_members.project_id', $id)
->where('users.status', 'active')
->get();
}
public static function checkIsMember($projectId, $userId)
{
return ProjectTemplateMember::where('project_template_id', $projectId)
->where('user_id', $userId)->first();
}
}