validation - Class 'App\' not found on laravel 5.2 -
i want add data database after successful validation,but error.'
fatalthrowableerror in aboutcontroller.php line 51: class 'app\about' not found.
my controller
<?php namespace app\http\controllers; use app\about; use illuminate\http\request; use app\http\requests; class aboutcontroller extends controller { public function store(request $request) { // $about = $request->about; $validation = \validator::make($about, about::$rules); if($validation->passes()) { about::create($about); return route('about/admin')->compact(about); } }
my model
<?php namespace app\http\controllers; use illuminate\database\eloquent\model; class extends model { // protected $guarded = array('id'); protected $fillable = array('about'); public static $rules = array('about' => 'required|5'); }
location of controllers , model:
app\http\controllers\aboutcontroller app\about
i have tried run
php artisan cache:clear php artisan clear-compiled composer dump-autoload
i'm stuck can tell me causing this?
as @webneat said should change namespace using in model.
your model about
<?php namespace app\http\controllers; use illuminate\database\eloquent\model; class extends model {
controller
<?php namespace app\http\controllers; use app\about; // have declared app\http\controllers in model
model fixed
<?php namespace app; // change namespace use illuminate\database\eloquent\model; class extends model {
if you're bit lost laravel or namespaces recommend use php artisan each of commands, , see , study reading code generated. case with:
php artisan make:model
you fresh new model prepared receive code correct namespace.
Comments
Post a Comment