Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Sentry with Ardent in Laravel?

In my models I use Ardent for self-validating but I have a model where I also need to use Sentry for authentication. So I need to extend Ardent and Sentry too, but I can't because there is no multiple inheritance in PHP. I tried to do it with traits, but traits can't extend. I hardly need both classes, is there a way I can use both of them?

like image 846
totymedli Avatar asked Aug 02 '13 08:08

totymedli


1 Answers

I think the best way to do this would be to copy the entire User model directly from the Sentry folder: e.g. src/Cartalyst/Sentry/Users/Eloquent/User.php

Copy that file to your models directory, then have it extend Ardent instead of Model since Ardent already extends Model.

This should work -- though there could be some complications or fixes needed to make it work, I'm doing something similar using Toddish/Verify instead of Sentry.

like image 124
PatrickCurl Avatar answered Sep 19 '22 18:09

PatrickCurl