Completed
Pull Request — master (#34)
by Fèvre
05:50 queued 02:49
created

DiscussController::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
namespace Xetaravel\Http\Controllers\Discuss;
3
4
use Illuminate\View\View;
5
use Xetaravel\Models\DiscussConversation;
6
7
class DiscussController extends Controller
8
{
9
    /**
10
     * Display all conversations.
11
     *
12
     * @return \Illuminate\View\View
13
     */
14
    public function index(): View
15
    {
16
        $conversations = DiscussConversation::with('User', 'Category', 'FirstPost', 'LastPost')
17
            ->orderBy('is_pinned', 'desc')
18
            ->orderBy('created_at', 'desc')
19
            ->paginate(config('xetaravel.pagination.discuss.conversation_per_page'));
20
21
        $breadcrumbs = $this->breadcrumbs;
22
23
        return view('Discuss::index', compact('breadcrumbs', 'conversations'));
24
    }
25
}
26