Skip to content

Commit

Permalink
Merge pull request #567 from HDInnovations/feature/chat-private-messages
Browse files Browse the repository at this point in the history
(Add) Shoutbox Private Messages / Bots
  • Loading branch information
HDVinnie authored Feb 9, 2019
2 parents 2a8896f + 7936169 commit 9b87a01
Show file tree
Hide file tree
Showing 58 changed files with 4,510 additions and 503 deletions.
49 changes: 49 additions & 0 deletions app/Bot.php
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'];
}
79 changes: 79 additions & 0 deletions app/BotTransaction.php
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';
}
}
Loading

0 comments on commit 9b87a01

Please sign in to comment.