-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
Hi i was trying to use the laravel-multi-tenant in Laravel 5 most of thing works fine, but the findOrFail in the trait that calls the parent::findOrFail does not work anymore because theres no FindOrFail in the eloquent model anymore, just in the builder. Anyone knows how can i have a workaround it?
/**
* Override the default findOrFail method so that we can rethrow a more useful exception.
* Otherwise it can be very confusing why queries don't work because of tenant scoping issues.
*
* @param $id
* @param array $columns
*
* @throws TenantModelNotFoundException
*/
public static function findOrFail($id, $columns = ['*'])
{
try {
return parent::findOrFail($id, $columns);
} catch (ModelNotFoundException $e) {
throw with(new TenantModelNotFoundException())->setModel(get_called_class());
}
}
Metadata
Metadata
Assignees
Labels
No labels