-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #567 from HDInnovations/feature/chat-private-messages
(Add) Shoutbox Private Messages / Bots
- Loading branch information
Showing
58 changed files
with
4,510 additions
and
503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE. | ||
* | ||
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0 | ||
* The details is bundled with this project in the file LICENSE.txt. | ||
* | ||
* @project UNIT3D | ||
* | ||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 | ||
* @author singularity43 | ||
*/ | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Bot extends Model | ||
{ | ||
/** | ||
* The Database Table Used By The Model. | ||
* | ||
* @var string | ||
*/ | ||
protected $table = 'bots'; | ||
|
||
/** | ||
* Indicates If The Model Should Be Timestamped. | ||
* | ||
* @var bool | ||
*/ | ||
public $timestamps = true; | ||
|
||
/** | ||
* The Attributes That Should Be Cast To Native Types. | ||
* | ||
* @var array | ||
*/ | ||
protected $casts = [ | ||
'name' => 'string', | ||
]; | ||
|
||
/** | ||
* The attributes that should be mutated to dates. | ||
* | ||
* @var array | ||
*/ | ||
protected $dates = ['deleted_at']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE. | ||
* | ||
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0 | ||
* The details is bundled with this project in the file LICENSE.txt. | ||
* | ||
* @project UNIT3D | ||
* | ||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 | ||
* @author singularity43 | ||
*/ | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class BotTransaction extends Model | ||
{ | ||
/** | ||
* The Database Table Used By The Model. | ||
* | ||
* @var string | ||
*/ | ||
protected $table = 'bot_transactions'; | ||
|
||
/** | ||
* Indicates If The Model Should Be Timestamped. | ||
* | ||
* @var bool | ||
*/ | ||
public $timestamps = true; | ||
|
||
/** | ||
* Belongs To A User. | ||
* | ||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
*/ | ||
|
||
// Bad name to not conflict with sender (not sender_id) | ||
|
||
public function user() | ||
{ | ||
return $this->belongsTo(User::class)->withDefault([ | ||
'username' => 'System', | ||
'id' => '1', | ||
]); | ||
} | ||
|
||
/** | ||
* Belongs To A Bot. | ||
* | ||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
*/ | ||
|
||
// Bad name to not conflict with sender (not sender_id) | ||
|
||
public function bot() | ||
{ | ||
return $this->belongsTo(Bot::class)->withDefault([ | ||
'username' => 'System', | ||
'id' => '1', | ||
]); | ||
} | ||
|
||
/** | ||
* Get the Bot transaction type answer as string. | ||
* | ||
* @return int | ||
*/ | ||
public function forHumans() | ||
{ | ||
if ($this->type == 'bon') { | ||
return 'BON'; | ||
} | ||
|
||
return 'Unknown'; | ||
} | ||
} |
Oops, something went wrong.