Skip to content

Commit

Permalink
project principal
Browse files Browse the repository at this point in the history
  • Loading branch information
lxerxa committed Nov 2, 2020
1 parent 83dcd27 commit df1beda
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions app/Http/Controllers/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,18 +568,25 @@ public function store(Request $request)
$insValues['key'] = $key;

$principal = $request->input('principal');
if (!isset($principal) || !$principal)
{
$insValues['principal'] = [ 'id' => $this->user->id, 'name' => $this->user->first_name, 'email' => $this->user->email ];
if (isset($principal) && $principal)
{
if ($principal == 'self')
{
$insValues['principal'] = [ 'id' => $this->user->id, 'name' => $this->user->first_name, 'email' => $this->user->email ];
}
else
{
$principal_info = Sentinel::findById($principal);
if (!$principal_info)
{
throw new \InvalidArgumentException('the user is not exists.', -14003);
}
$insValues['principal'] = [ 'id' => $principal_info->id, 'name' => $principal_info->first_name, 'email' => $principal_info->email ];
}
}
else
{
$principal_info = Sentinel::findById($principal);
if (!$principal_info)
{
throw new \InvalidArgumentException('the user is not exists.', -14003);
}
$insValues['principal'] = [ 'id' => $principal_info->id, 'name' => $principal_info->first_name, 'email' => $principal_info->email ];
$insValues['principal'] = [ 'id' => $this->user->id, 'name' => $this->user->first_name, 'email' => $this->user->email ];
}

$description = $request->input('description');
Expand Down

0 comments on commit df1beda

Please sign in to comment.