omarsow94

the whole controller :

<?php

namespace App\Http\Controllers;

use App\Repositories\ConversationRepository;
use Illuminate\Http\Request;
use Illuminate\Auth\AuthManager;
use Illuminate\Support\Facades\Auth;
use App\User;


class ConversationsController extends Controller
{
    private $r;
    private $auth;

    public function __construct(ConversationRepository $conversationRepository, AuthManager $auth)
    {
        $this->r = $conversationRepository;
        $this->auth = $auth;
    }
    public function index()
    {
        return view('conversations.index',[
            'users' => $this->r->getConversations($this->auth->user()->id)
        ]);
    }

    public function show(User $user)
    {
        return view('conversations.show',[
            'users' => $this->r->getConversations($this->auth->user()->id),
            'user' => $user
        ]);
    }

    public function store(User $user, Request $request)
    {
        $this->r-createMessage(
            $request->get('content'),
            $request->auth->user()->id,
            $user->id
        );
    }


}

@jbloomstrom

Return to Thread...