Laravel PHP: Validators Class inside 'Models' folder not found

360

I have a folder named 'Validators' inside my 'Models' folder that contains the validation files for creating new records. I have not had problems in the past putting this folder inside the 'Models' folder within my Laravel PHP project but for some odd reason when I try to create/store new records, I keep getting a Class 'Models\Validators\Stone' not found error.

Controller:

<?php

use Acme\repositories\StoneRepository;

use Acme\repositories\PhotoRepository;

use Models\Stone;

use Models\Stone_Photo;

/* 'Validators' folder inside 'Models' folder */

use Models\Validators as Validators;

     class StonesController extends BaseController {

     /*The stone model */

     protected $stone;

     /*The stone_photo model */

     protected $stone_photo;

     protected $layout = 'layouts.master';

     /* This is the function that is currently being called */

     public function store()
     {
       $input = \Input::all();

       /* This is where the error occurs on this line below */

       $validation = new Validators\Stone;

       /* Validation code here */       

     }    

 }

Stone Validator (app\models\validators\stone.php):

<?php namespace Models\Validators;

class Stone extends Validator {

/* The rules for validating the input */

public static $rules = array(
        'stone_name' => 'required',
        'stone_description' => 'max:255',
    );
}

I have tried running 'php artisan dump-autoload' but that still does not change anything. This implementation has worked for me in the past but for some reason I keep getting this error and I don't know why. Any help is greatly appreciated!

People are also looking for solutions to the problem: php - Displaying message outside of while loop

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.