Skip to main content
2 de 5
Etiqueta, formato, etc
OscarGarcia
  • 28.5k
  • 3
  • 29
  • 64

Error Class App\Repositories\Messages does not exist

Estoy intentando crear un repositorio para mis consultas pero me dice que la clase no existe.

Les muestro los fragmentos de código para ver si alguien sabe cuál es el error:

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;
    } 

Ruta de mi repositorio app/Repositories/Messages.php

Messages.php

<?php

namespace App\Repositories\Messages;

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); 
            });
    }
}