#51 2 Business Points edit / add, user dashboard
This commit is contained in:
parent
263cf93a1e
commit
dfd049aaa9
25 changed files with 1291 additions and 381 deletions
16
app/User.php
16
app/User.php
|
|
@ -476,8 +476,9 @@ class User extends Authenticatable
|
|||
|
||||
public function getUserSalesVolumeBy($month, $year, $key)
|
||||
{
|
||||
//NOTE check ist, cant change month year !
|
||||
if($this->userSalesVolume === false){
|
||||
$this->userSalesVolume = UserSalesVolume::where('user_id', $this->id)->where('month', $month)->where('year', $year)->get()->last();
|
||||
$this->userSalesVolume = $this->getUserSalesVolume($month, $year, 'first');
|
||||
}
|
||||
if($this->userSalesVolume){
|
||||
switch ($key) {
|
||||
|
|
@ -507,7 +508,18 @@ class User extends Authenticatable
|
|||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public function getUserSalesVolume($month, $year, $record = 'get')
|
||||
{
|
||||
$query = UserSalesVolume::where('user_id', $this->id)->where('month', $month)->where('year', $year)->orderBy('id', 'DESC');
|
||||
switch ($record) {
|
||||
case 'get':
|
||||
return $query->get();
|
||||
break;
|
||||
case 'first':
|
||||
return $query->first();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue