<?php

namespace App\Models;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

class ProjectUser extends BaseModel
{
    public function projectRole()
    {
        return $this->belongsTo('App\Models\ProjectRole', 'project_role_id');
    }

    public function user()
    {
        return $this->belongsTo('App\Models\User', 'user_id');
    }

    public function getValidator(Request $request, $type)
    {
        $validator = Validator::make($request->input('data'), [
            'user_id' => 'required'
        ], [
            'user_id.required' => '用户必选'
        ]);
        return $validator;
    }
}
