php - How do I namespace a model in Laravel so as not to clash with an existing class? -
in laravel 4 want use model represents event
coming database. thus, in app/models
have event
model extends eloquent.
however, laravel 4 has event
class used manage events within application lifecycle.
what want know is, how can namespace event
model , access in way not clash existing event
class.
you need apply namespace would. so, example.
<?php namespace models; use eloquent; class event extends eloquent { }
you should correctly setup composer.json
loads models. use classmap
or psr-0
this, depending on whether or not you're following psr-0 directory structure.
i'm pretty sure models
directory mapped.
edit
mentioned in comments must run composer dump-autoload
.
Comments
Post a Comment