Monday 15 August 2011

Laravel 4 PHP: 'Use' statement with both local files and package files -



Laravel 4 PHP: 'Use' statement with both local files and package files -

i trying include custom defined validation file local scheme , wish utilize 'package' files application downloaded online. purpose can have own custom validators since made modifications application.

i maintain getting error -> 'class 'models\validators\photo' not found'

controller:

utilize jeroeng\laravelphotogallery\controllers\albumscontroller; /* bundle */ utilize jeroeng\laravelphotogallery\controllers\photoscontroller; /* bundle */ utilize jeroeng\laravelphotogallery\models\album; /* bundle */ utilize jeroeng\laravelphotogallery\models\photo; /* bundle */ utilize models\validators validators; /* custom local file */ class editphotoscontroller extends photoscontroller { public function __construct() { parent::__construct(); } public function update($albumid, $photoid) { $input = \input::except('_method'); $validation = new validators\photo($input); // here's error occurs /* validation check , update code etc. */ } } }

photo.php -> file path: models\validators\photo.php

namespace models\validators; class photo extends validator { public static $rules = array( 'album_id' => 'required', 'photo_name' => 'required', 'photo_description' => 'max:255', ); }

is simple namespacing issue?

the problem composer doesn't add together file models/validators/photo.php autoload index. create sure have provided right path files in composer.json.

php laravel-4

No comments:

Post a Comment