Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4cc4d2b
commit d68b2ca
Showing
49 changed files
with
4,097 additions
and
368 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
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
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
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,37 @@ | ||
<?php | ||
|
||
namespace App\Modules\Adaptbb\Listeners; | ||
|
||
use App\Modules\Adaptbb\Models\Topic; | ||
use App\Modules\Posts\Events\AdminDashboardEvent; | ||
|
||
use Cache; | ||
|
||
class AdminDashboardListener | ||
{ | ||
/** | ||
* Handle the event. | ||
* | ||
* @param AdminDashboardEvent $event | ||
* @return void | ||
*/ | ||
public function handle(AdminDashboardEvent $event) | ||
{ | ||
$admin_dashboard_data = json_decode(Cache::get('admin_dashboard_data'), true); | ||
|
||
// most recent forum topics | ||
$topics = Topic::with('replies')->where('active', '=', 1)->orderBy('created_at', 'DESC')->take(5)->get(); | ||
|
||
$admin_dashboard_data['most_recent_forum_topics'] = [ | ||
'collection' => collect([]), | ||
'viewPath' => 'adaptbb::Partials/admin_dashboard' | ||
]; | ||
foreach($topics as $topic) { | ||
$topic->url = $topic->getUrl(); | ||
|
||
$admin_dashboard_data['most_recent_forum_topics']['collection']->push($topic); | ||
} | ||
|
||
Cache::put('admin_dashboard_data', json_encode($admin_dashboard_data), 15); | ||
} | ||
} |
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
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
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
3 changes: 3 additions & 0 deletions
3
app/Modules/Adaptbb/Resources/Views/Partials/admin_dashboard.blade.php
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,3 @@ | ||
<h3>Adaptbb</h3> | ||
|
||
<?php print_r($data) ?> |
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
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,25 @@ | ||
<?php | ||
|
||
namespace App\Modules\Posts\Events; | ||
|
||
use Illuminate\Queue\SerializesModels; | ||
|
||
use Cache; | ||
|
||
class AdminDashboardEvent | ||
{ | ||
use SerializesModels; | ||
|
||
public $admin_dashboard_data = []; | ||
|
||
/** | ||
* Create a new event instance. | ||
* | ||
* @param Order $order | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
|
||
} | ||
} |
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
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
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
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
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,38 @@ | ||
<?php | ||
|
||
namespace App\Modules\Posts\Listeners; | ||
|
||
use App\Modules\Posts\Models\Post; | ||
use App\Modules\Posts\Events\AdminDashboardEvent; | ||
|
||
use Cache; | ||
|
||
class AdminDashboardListener | ||
{ | ||
/** | ||
* Handle the event. | ||
* | ||
* @param AdminDashboardEvent $event | ||
* @return void | ||
*/ | ||
public function handle(AdminDashboardEvent $event) | ||
{ | ||
$admin_dashboard_data = json_decode(Cache::get('admin_dashboard_data'), true); | ||
|
||
// posts | ||
$posts = Post::where('status', '=', 0)->get(); | ||
|
||
$admin_dashboard_data['pending_posts'] = [ | ||
'collection' => collect([]), | ||
'viewPath' => 'posts::Partials/admin_dashboard' | ||
]; | ||
|
||
foreach($posts as $post) { | ||
$post->url = route('posts.view', [ 'slug' => $post->slug ]); | ||
|
||
$admin_dashboard_data['pending_posts']['collection']->push($post); | ||
} | ||
|
||
Cache::put('admin_dashboard_data', json_encode($admin_dashboard_data), 15); | ||
} | ||
} |
Oops, something went wrong.