AndrewMcLagan
AndrewMcLagan

Reputation: 13987

Class alias conflict Laravel 4

Currently I'm using Laravel 4 for a project.

I have a model called "Event" it is conflicting with an event alias defined in the file:

app/config/app.php

in the class aliases array "Event" appears as such:

'Event'  => 'Illuminate\Support\Facades\Event',

How can I overcome this? As I really really do not wish to rename my event model.

Upvotes: 0

Views: 1270

Answers (1)

Safeer
Safeer

Reputation: 714

Change the Alias for the Event Class to LaravelEvent...then you can call the Laravel Event Class using the new Alias you picked or you can remove the Laravel Event alias altogether and call that class by it's full namespace when needed.

Alternatively you could add an Alias for your Event Model Class, but as it seems quite a core class in your system you might be better off renaming your Event Class to something less likely to conflict.

Upvotes: 7

Related Questions