<?php

namespace App\Inventory;

use Illuminate\Database\Eloquent\Model;
use App\Branch;
use App\User;

class Usertoproject extends Model
{

    public function __construct()
    {

    }

		public function addproject($object)
    {
        return \DB::transaction(function () use ($object)  {


          $usertoproject                      = new Usertoproject;
          $usertoproject->user_id                = $object['user_id'];
          $usertoproject->branch_id                = $object['branch_id'];


          $usertoproject->save();


            return with($usertoproject);


        });
    }

    public function branch()
    {
       return $this->belongsTo(Branch::class,'branch_id');
    }

     public function user()
    {
       return $this->belongsTo(User::class,'user_id');

    }
}
