I am trying to create a repository for my queries but it tells me that the class does not exist.
I show you the code snippets to see if anyone knows what the error is:
MessagesControler.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Carbon\Carbon;
use App\Message;
use App\Repositories\Messages;
use App\Events\MessageWasRecived;
use Illuminate\Support\Facades\Cache;
use App\Http\Requests\CreateMessageRequest;
class MessagesController extends Controller
{
protected $messeges;
function __construct(Messages $messeges)
{
$this->middleware('auth',['except' => ['create','store']]);
$this->messeges = $messeges;
}
Path of my repository app/Repositories/Messages.php
Messages.php
<?php
namespace App\Repositories;
use App\Message;
use Illuminate\Support\Facades\Cache;
class Messages
{
public function index()
{
$key = 'message.page' . request('page', 1);
return = Cache::tags('messages')->rememberForever($key, function() {
return Message::with(['user','note','tags'])
->orderBy('created_at', request('sorted','ASC'))
->paginate(10);
});
}
}