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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -