mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-23 19:50:40 -05:00
(Update)[Chat 2.0] Updating system messages
Added a Helpers file for some common usages. Its being autoloaded via composer.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('appurl')) {
|
||||
function appurl()
|
||||
{
|
||||
return config('app.url');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('hrefProfile')) {
|
||||
function hrefProfile($user)
|
||||
{
|
||||
$appurl = appurl();
|
||||
return "{$appurl}/{$user->username}.{$user->id}";
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('hrefArticle')) {
|
||||
function hrefArticle($article)
|
||||
{
|
||||
$appurl = appurl();
|
||||
return "{$appurl}/articles/{$article->slug}.{$article->id}";
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('hrefTorrent')) {
|
||||
function hrefTorrent($torrent)
|
||||
{
|
||||
$appurl = appurl();
|
||||
return "{$appurl}/torrents/{$torrent->slug}.{$torrent->id}";
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('hrefTorrentRequest')) {
|
||||
function hrefTorrentRequest($torrentRequest)
|
||||
{
|
||||
$appurl = appurl();
|
||||
return "{$appurl}/request/{$torrentRequest->slug}.{$torrentRequest->id}";
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('hrefPoll')) {
|
||||
function hrefPoll($poll)
|
||||
{
|
||||
$appurl = appurl();
|
||||
return "{$appurl}/poll/{$poll->slug}";
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Repositories\ChatRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\User;
|
||||
@@ -25,6 +26,12 @@ use \Toastr;
|
||||
|
||||
class BonusController extends Controller
|
||||
{
|
||||
private $chat;
|
||||
|
||||
public function __construct(ChatRepository $chat)
|
||||
{
|
||||
$this->chat = $chat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bonus System
|
||||
@@ -217,9 +224,12 @@ class BonusController extends Controller
|
||||
]);
|
||||
$transaction->save();
|
||||
|
||||
$appurl = config('app.url');
|
||||
Message::create(['user' => "1", 'chatroom_id' => "3", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has gifted " . $value . "BON to [url={$appurl}/"
|
||||
. $recipient->username . "." . $recipient->id . "]" . $recipient->username . "[/url]"]);
|
||||
$profile_url = hrefProfile($user);
|
||||
$recipient_url = hrefProfile($recipient);
|
||||
|
||||
$this->chat->systemMessage(
|
||||
"[url={$profile_url}]{$user->username}[/url] has gifted {$value} BON to [url={$recipient_url}]{$recipient->username}[/url]"
|
||||
);
|
||||
|
||||
PrivateMessage::create(['sender_id' => $user->id, 'reciever_id' => $recipient->id, 'subject' => "You Have Recieved A Gift", 'message' => $transaction->comment]);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Repositories\ChatRepository;
|
||||
use App\Repositories\TaggedUserRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use App\User;
|
||||
@@ -45,9 +46,12 @@ class CommentController extends Controller
|
||||
*/
|
||||
private $tag;
|
||||
|
||||
public function __construct(TaggedUserRepository $tag)
|
||||
private $chat;
|
||||
|
||||
public function __construct(TaggedUserRepository $tag, ChatRepository $chat)
|
||||
{
|
||||
$this->tag = $tag;
|
||||
$this->chat = $chat;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,14 +94,16 @@ class CommentController extends Controller
|
||||
$comment->article_id = $article->id;
|
||||
$comment->save();
|
||||
|
||||
$appurl = config('app.url');
|
||||
$article_url = hrefArticle($article);
|
||||
$profile_url = hrefProfile($user);
|
||||
|
||||
$this->chat->systemMessage(
|
||||
"[url={$profile_url}]{$user->username}[/url] has left a comment on article [url={$article_url}]{$article->title}[/url]"
|
||||
);
|
||||
|
||||
if ($this->tag->hasTags($content)) {
|
||||
|
||||
//$this->tag->setDebug(true);
|
||||
|
||||
$href = "{$appurl}/articles/{$article->slug}.{$article->id}";
|
||||
$message = "{$user->username} has tagged you in a comment. You can view it [url={$href}] HERE [/url]";
|
||||
$pm = "[url={$profile_url}]{$user->username}[/url] has tagged you in a comment. You can view it [url={$article_url}]HERE[/url]";
|
||||
|
||||
if ($this->tag->contains($content, '@here') && $user->group->is_modo) {
|
||||
$users = collect([]);
|
||||
@@ -108,18 +114,16 @@ class CommentController extends Controller
|
||||
|
||||
$this->tag->messageUsers($users,
|
||||
"You are being notified by staff!",
|
||||
$message
|
||||
$pm
|
||||
);
|
||||
} else {
|
||||
$this->tag->messageTaggedUsers($content,
|
||||
"You have been tagged by {$user->username}",
|
||||
$message
|
||||
$pm
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Message::create(['user_id' => "1", 'chatroom_id' => "3", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has left a comment on article [url={$appurl}/articles/" . $article->slug . "." . $article->id . "]" . $article->title . "[/url]"]);
|
||||
|
||||
return redirect()->route('article', [
|
||||
'slug' => $article->slug,
|
||||
'id' => $article->id])->with(Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']));
|
||||
@@ -167,14 +171,28 @@ class CommentController extends Controller
|
||||
$comment->torrent_id = $torrent->id;
|
||||
$comment->save();
|
||||
|
||||
$appurl = config('app.url');
|
||||
//Notification
|
||||
if ($user->id != $torrent->user_id) {
|
||||
User::find($torrent->user_id)->notify(new NewTorrentComment($comment));
|
||||
}
|
||||
|
||||
$torrent_url = hrefTorrent($torrent);
|
||||
$profile_url = hrefProfile($user);
|
||||
|
||||
// Auto Shout
|
||||
if ($comment->anon == 0) {
|
||||
$this->chat->systemMessage(
|
||||
"[url={$profile_url}]{$user->username}[/url] has left a comment on Torrent [url={$torrent_url}]{$torrent->name}[/url]"
|
||||
);
|
||||
} else {
|
||||
$this->chat->systemMessage(
|
||||
"An anonymous user has left a comment on torrent [url={$torrent_url}]{$torrent->name}[/url]"
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->tag->hasTags($content)) {
|
||||
|
||||
//$this->tag->setDebug(true);
|
||||
|
||||
$href = "{$appurl}/torrents/{$torrent->slug}.{$torrent->id}";
|
||||
$message = "{$user->username} has tagged you in a comment. You can view it [url={$href}] HERE [/url]";
|
||||
$message = "[url={$profile_url}]{$user->username}[/url] has tagged you in a comment. You can view it [url={$torrent_url}]HERE[/url]";
|
||||
|
||||
if ($this->tag->contains($content, '@here') && $user->group->is_modo) {
|
||||
$users = collect([]);
|
||||
@@ -209,18 +227,6 @@ class CommentController extends Controller
|
||||
$user->addProgress(new UserMade800Comments(), 1);
|
||||
$user->addProgress(new UserMade900Comments(), 1);
|
||||
|
||||
//Notification
|
||||
if ($user->id != $torrent->user_id) {
|
||||
User::find($torrent->user_id)->notify(new NewTorrentComment($comment));
|
||||
}
|
||||
|
||||
// Auto Shout
|
||||
if ($comment->anon == 0) {
|
||||
Message::create(['user_id' => "1", 'chatroom_id' => "3", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has left a comment on Torrent [url={$appurl}/torrents/" . $torrent->slug . "." . $torrent->id . "]" . $torrent->name . "[/url]"]);
|
||||
} else {
|
||||
Message::create(['user_id' => "1", 'chatroom_id' => "3", 'message' => "An anonymous user has left a comment on torrent [url={$appurl}/torrents/" . $torrent->slug . "." . $torrent->id . "]" . $torrent->name . "[/url]"]);
|
||||
}
|
||||
|
||||
return redirect()->route('torrent', [
|
||||
'slug' => $torrent->slug,
|
||||
'id' => $torrent->id
|
||||
@@ -235,7 +241,7 @@ class CommentController extends Controller
|
||||
*/
|
||||
public function request(Request $request, $id)
|
||||
{
|
||||
$torrentRequest = TorrentRequest::findOrFail($id);
|
||||
$tr = TorrentRequest::findOrFail($id);
|
||||
$user = auth()->user();
|
||||
|
||||
$v = validator($request->all(), [
|
||||
@@ -263,22 +269,31 @@ class CommentController extends Controller
|
||||
$comment->content = $content;
|
||||
$comment->anon = $request->input('anonymous');
|
||||
$comment->user_id = $user->id;
|
||||
$comment->requests_id = $torrentRequest->id;
|
||||
$comment->requests_id = $tr->id;
|
||||
$comment->save();
|
||||
|
||||
$appurl = config('app.url');
|
||||
$tr_url = hrefTorrentRequest($tr);
|
||||
$profile_url = hrefProfile($user);
|
||||
|
||||
// Auto Shout
|
||||
if ($comment->anon == 0) {
|
||||
$this->chat->systemMessage(
|
||||
"[url={$profile_url}]{$user->username}[/url] has left a comment on Request [url={$tr_url}]{$tr->name}[/url]"
|
||||
);
|
||||
} else {
|
||||
$this->chat->systemMessage(
|
||||
"An anonymous user has left a comment on Request [url={$tr_url}]{$tr->name}[/url]"
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->tag->hasTags($content)) {
|
||||
|
||||
//$this->tag->setDebug(true);
|
||||
|
||||
$href = "{$appurl}/request/{$torrentRequest->id}";
|
||||
$message = "{$user->username} has tagged you in a comment. You can view it [url={$href}] HERE [/url]";
|
||||
$message = "[url={$profile_url}]{$user->username}[/url] has tagged you in a comment. You can view it [url={$tr_url}] HERE [/url]";
|
||||
|
||||
if ($this->tag->contains($content, '@here') && $user->group->is_modo) {
|
||||
$users = collect([]);
|
||||
|
||||
$torrentRequest->comments()->get()->each(function ($c, $v) use ($users) {
|
||||
$tr->comments()->get()->each(function ($c, $v) use ($users) {
|
||||
$users->push($c->user);
|
||||
});
|
||||
|
||||
@@ -310,18 +325,11 @@ class CommentController extends Controller
|
||||
|
||||
// Auto PM
|
||||
if ($user->id != $request->user_id) {
|
||||
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $torrentRequest->user_id, 'subject' => "Your Request " . $torrentRequest->name . " Has A New Comment!", 'message' => $comment->user->username . " Has Left A Comment On [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
|
||||
}
|
||||
|
||||
// Auto Shout
|
||||
if ($comment->anon == 0) {
|
||||
Message::create(['user_id' => "1", 'chatroom_id' => "3", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has left a comment on Request [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
|
||||
} else {
|
||||
Message::create(['user_id' => "1", 'chatroom_id' => "3", 'message' => "An anonymous user has left a comment on request [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
|
||||
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $tr->user_id, 'subject' => "Your Request " . $tr->name . " Has A New Comment!", 'message' => $comment->user->username . " Has Left A Comment On [url={$appurl}/request/" . $tr->id . "]" . $tr->name . "[/url]"]);
|
||||
}
|
||||
|
||||
return redirect()->route('request', [
|
||||
'id' => $torrentRequest->id
|
||||
'id' => $tr->id
|
||||
])->with(Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']));
|
||||
}
|
||||
|
||||
@@ -373,8 +381,13 @@ class CommentController extends Controller
|
||||
}
|
||||
|
||||
// Auto Shout
|
||||
$appurl = config('app.url');
|
||||
Message::create(['user_id' => "1", 'chatroom_id' => "3", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has left a comment on Torrent [url={$appurl}/torrents/" . $torrent->slug . "." . $torrent->id . "]" . $torrent->name . "[/url]"]);
|
||||
$torrent_url = hrefTorrent($torrent);
|
||||
$profile_url = hrefProfile($user);
|
||||
|
||||
$this->chat->systemMessage(
|
||||
"[url={$profile_url}]{$user->username}[/url] has left a comment on Torrent [url={$torrent_url}]{$torrent->name}[/url]"
|
||||
);
|
||||
|
||||
} else {
|
||||
Toastr::error('A Error Has Occured And Your Comment Was Not Posted!', 'Whoops!', ['options']);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Repositories\ChatRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\VoteOnPoll;
|
||||
use App\Poll;
|
||||
@@ -22,6 +23,13 @@ use \Toastr;
|
||||
|
||||
class PollController extends Controller
|
||||
{
|
||||
private $chat;
|
||||
|
||||
public function __construct(ChatRepository $chat)
|
||||
{
|
||||
$this->chat = $chat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
@@ -74,11 +82,12 @@ class PollController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
$slug = $poll->slug;
|
||||
$url = config('app.url');
|
||||
$title = $poll->title;
|
||||
$poll_url = hrefPoll($poll);
|
||||
$profile_url = hrefProfile($user);
|
||||
|
||||
Message::create(["user_id" => "1", "mentions" => "3", "message" => "A user has voted on poll [url=${url}/poll/$slug]${title}[/url]"]);
|
||||
$this->chat->systemMessage(
|
||||
"[url={$profile_url}]{$user->username}[/url] has voted on poll [url={$poll_url}]{$poll->title}[/url]"
|
||||
);
|
||||
|
||||
return redirect('poll/' . $poll->slug . '/result')->with(Toastr::success('Your vote has been counted.', 'Yay!', ['options']));
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Repositories\ChatRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use App\BonTransactions;
|
||||
use App\Category;
|
||||
@@ -40,9 +41,12 @@ class RequestController extends Controller
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
public function __construct(RequestFacetedRepository $repository)
|
||||
private $chat;
|
||||
|
||||
public function __construct(RequestFacetedRepository $repository, ChatRepository $chat)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
$this->chat = $chat;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,7 +242,7 @@ class RequestController extends Controller
|
||||
$category = Category::findOrFail($request->input('category_id'));
|
||||
|
||||
// Holders for new data
|
||||
$torrentRequest = new TorrentRequest([
|
||||
$tr = new TorrentRequest([
|
||||
'name' => $request->input('name'),
|
||||
'description' => $request->input('description'),
|
||||
'category_id' => $category->id,
|
||||
@@ -251,12 +255,12 @@ class RequestController extends Controller
|
||||
'bounty' => $request->input('bounty'),
|
||||
'votes' => 1,
|
||||
]);
|
||||
$torrentRequest->save();
|
||||
$tr->save();
|
||||
|
||||
$requestsBounty = new TorrentRequestBounty([
|
||||
'user_id' => $user->id,
|
||||
'seedbonus' => $request->input('bounty'),
|
||||
'requests_id' => $torrentRequest->id,
|
||||
'requests_id' => $tr->id,
|
||||
]);
|
||||
$requestsBounty->save();
|
||||
|
||||
@@ -273,12 +277,16 @@ class RequestController extends Controller
|
||||
$user->seedbonus -= $request->input('bounty');
|
||||
$user->save();
|
||||
|
||||
// Announce To Chat
|
||||
$appurl = config('app.url');
|
||||
Message::create(['user_id' => "1", 'chatroom_id' => "3", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has created a new request [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
|
||||
$tr_url = hrefTorrentRequest($tr);
|
||||
$profile_url = hrefProfile($user);
|
||||
|
||||
// Auto Shout
|
||||
$this->chat->systemMessage(
|
||||
"[url={$profile_url}]{$user->username}[/url] has created a new request [url={$tr_url}]{$tr->name}[/url]"
|
||||
);
|
||||
|
||||
// Activity Log
|
||||
\LogActivity::addToLog("Member {$user->username} has made a new torrent request, ID: {$torrentRequest->id} NAME: {$torrentRequest->name} .");
|
||||
\LogActivity::addToLog("Member {$user->username} has made a new torrent request, ID: {$tr->id} NAME: {$tr->name} .");
|
||||
|
||||
return redirect('/requests')->with(Toastr::success('Request Added.', 'Yay!', ['options']));
|
||||
} else {
|
||||
@@ -361,17 +369,17 @@ class RequestController extends Controller
|
||||
]);
|
||||
|
||||
if ($v->passes()) {
|
||||
$torrentRequest = TorrentRequest::findOrFail($request->input('request_id'));
|
||||
$tr = TorrentRequest::findOrFail($request->input('request_id'));
|
||||
|
||||
$torrentRequest->votes += 1;
|
||||
$torrentRequest->bounty += $request->input('bonus_value');
|
||||
$torrentRequest->created_at = Carbon::now();
|
||||
$torrentRequest->save();
|
||||
$tr->votes += 1;
|
||||
$tr->bounty += $request->input('bonus_value');
|
||||
$tr->created_at = Carbon::now();
|
||||
$tr->save();
|
||||
|
||||
$requestsBounty = new TorrentRequestBounty([
|
||||
'user_id' => $user->id,
|
||||
'seedbonus' => $request->input('bonus_value'),
|
||||
'requests_id' => $torrentRequest->id,
|
||||
'requests_id' => $tr->id,
|
||||
]);
|
||||
$requestsBounty->save();
|
||||
|
||||
@@ -381,22 +389,26 @@ class RequestController extends Controller
|
||||
'cost' => $request->input('bonus_value'),
|
||||
'sender' => $user->id,
|
||||
'receiver' => 0,
|
||||
'comment' => "adding bonus to {$torrentRequest->name}"
|
||||
'comment' => "adding bonus to {$tr->name}"
|
||||
]);
|
||||
$BonTransactions->save();
|
||||
|
||||
$user->seedbonus -= $request->input('bonus_value');
|
||||
$user->save();
|
||||
|
||||
// Announce To Chat
|
||||
$appurl = config('app.url');
|
||||
Message::create(['user_id' => "1", 'chatroom_id' => "1", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has addded " . $request->input('bonus_value') . " BON bounty to request " . "[url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
|
||||
$tr_url = hrefTorrentRequest($tr);
|
||||
$profile_url = hrefProfile($user);
|
||||
|
||||
// Auto Shout
|
||||
$this->chat->systemMessage(
|
||||
"[url={$profile_url}]{$user->username}[/url] has addded {$request->input('bonus_value')} BON bounty to request [url={$tr_url}]{$tr->name}[/url]"
|
||||
);
|
||||
|
||||
// Send Private Message
|
||||
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $torrentRequest->user_id, 'subject' => "Your Request " . $torrentRequest->name . " Has A New Bounty!", 'message' => $user->username . " Has Added A Bounty To " . "[url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url]"]);
|
||||
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $tr->user_id, 'subject' => "Your Request " . $tr->name . " Has A New Bounty!", 'message' => $user->username . " Has Added A Bounty To " . "[url={$appurl}/request/" . $tr->id . "]" . $tr->name . "[/url]"]);
|
||||
|
||||
// Activity Log
|
||||
\LogActivity::addToLog("Member {$user->username} has added a BON bounty to torrent request, ID: {$torrentRequest->id} NAME: {$torrentRequest->name} .");
|
||||
\LogActivity::addToLog("Member {$user->username} has added a BON bounty to torrent request, ID: {$tr->id} NAME: {$tr->name} .");
|
||||
|
||||
return redirect()->route('request', ['id' => $request->input('request_id')])->with(Toastr::success('Your bonus has been successfully added.', 'Yay!', ['options']));
|
||||
} else {
|
||||
@@ -483,16 +495,16 @@ class RequestController extends Controller
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$torrentRequest = TorrentRequest::findOrFail($id);
|
||||
$tr = TorrentRequest::findOrFail($id);
|
||||
|
||||
if ($user->id == $torrentRequest->user_id || auth()->user()->group->is_modo) {
|
||||
$torrentRequest->approved_by = $user->id;
|
||||
$torrentRequest->approved_when = Carbon::now();
|
||||
$torrentRequest->save();
|
||||
if ($user->id == $tr->user_id || auth()->user()->group->is_modo) {
|
||||
$tr->approved_by = $user->id;
|
||||
$tr->approved_when = Carbon::now();
|
||||
$tr->save();
|
||||
|
||||
//BON and torrent request hash code below
|
||||
$fill_user = User::findOrFail($torrentRequest->filled_by);
|
||||
$fill_amount = $torrentRequest->bounty;
|
||||
$fill_user = User::findOrFail($tr->filled_by);
|
||||
$fill_amount = $tr->bounty;
|
||||
|
||||
$BonTransactions = new BonTransactions([
|
||||
'itemID' => 0,
|
||||
@@ -500,7 +512,7 @@ class RequestController extends Controller
|
||||
'cost' => $fill_amount,
|
||||
'sender' => 0,
|
||||
'receiver' => $fill_user->id,
|
||||
'comment' => "{$fill_user->username} has filled {$torrentRequest->name} and has been awared {$fill_amount} BONUS."
|
||||
'comment' => "{$fill_user->username} has filled {$tr->name} and has been awared {$fill_amount} BONUS."
|
||||
]);
|
||||
$BonTransactions->save();
|
||||
|
||||
@@ -514,17 +526,21 @@ class RequestController extends Controller
|
||||
$fill_user->addProgress(new UserFilled75Requests(), 1);
|
||||
$fill_user->addProgress(new UserFilled100Requests(), 1);
|
||||
|
||||
// Announce To Chat
|
||||
$appurl = config('app.url');
|
||||
Message::create(['user_id' => "1", 'chatroom_id' => "1", 'message' => "User [url={$appurl}/" . $fill_user->username . "." . $fill_user->id . "]" . $fill_user->username . "[/url] has filled [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url] and was awarded " . $fill_amount . " BON "]);
|
||||
$tr_url = hrefTorrentRequest($tr);
|
||||
$profile_url = hrefProfile($fill_user);
|
||||
|
||||
// Auto Shout
|
||||
$this->chat->systemMessage(
|
||||
"[url={$profile_url}]{$fill_user->username}[/url] has filled [url={$tr_url}]{$tr->name}[/url]"
|
||||
);
|
||||
|
||||
// Send Private Message
|
||||
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $torrentRequest->filled_by, 'subject' => "Your Request Fullfill On " . $torrentRequest->name . " Has Been Approved!", 'message' => $torrentRequest->approved_by . " Has Approved Your Fullfillment On [url={$appurl}/request/" . $torrentRequest->id . "]" . $torrentRequest->name . "[/url] Enjoy The " . $torrentRequest->bounty . " Bonus Points!"]);
|
||||
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $tr->filled_by, 'subject' => "Your Request Fullfill On " . $tr->name . " Has Been Approved!", 'message' => $tr->approved_by . " Has Approved Your Fullfillment On [url={$appurl}/request/" . $tr->id . "]" . $tr->name . "[/url] Enjoy The " . $tr->bounty . " Bonus Points!"]);
|
||||
|
||||
// Activity Log
|
||||
\LogActivity::addToLog("Member {$user->username} has approved {$fill_user->username} fill on torrent request, ID: {$torrentRequest->id} NAME: {$torrentRequest->name} .");
|
||||
\LogActivity::addToLog("Member {$user->username} has approved {$fill_user->username} fill on torrent request, ID: {$tr->id} NAME: {$tr->name} .");
|
||||
|
||||
return redirect()->route('request', ['id' => $id])->with(Toastr::success("You have approved {$torrentRequest->name} and the bounty has been awarded to {$fill_user->username}", "Yay!", ['options']));
|
||||
return redirect()->route('request', ['id' => $id])->with(Toastr::success("You have approved {$tr->name} and the bounty has been awarded to {$fill_user->username}", "Yay!", ['options']));
|
||||
} else {
|
||||
return redirect()->route('request', ['id' => $id])->with(Toastr::error("You don't have access to approve this request", 'Whoops!', ['options']));
|
||||
}
|
||||
|
||||
+4
-1
@@ -52,7 +52,10 @@
|
||||
],
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"app/Helpers/Helpers.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
|
||||
Reference in New Issue
Block a user