v2 first commit

This commit is contained in:
denisdulici
2019-11-16 10:21:14 +03:00
parent 5b23e9c2c4
commit 6d50fa8442
3075 changed files with 3451681 additions and 65594 deletions

42
app/Traits/Users.php Normal file
View File

@ -0,0 +1,42 @@
<?php
namespace App\Traits;
use App\Models\Auth\User;
trait Users
{
/**
* Get user logged in
*
* @return object
*/
public function getCurrentUser()
{
return user();
}
/**
* Check user company assignment
*
* @param $id
*
* @return boolean
*/
public function isUserCompany($id)
{
$user = user();
if (empty($user)) {
return false;
}
$companies = $user->companies()->pluck('id')->toArray();
if (in_array($id, $companies)) {
return true;
}
return false;
}
}