Using baum/baum with laravel authentication - php

I am trying to use Baum to manage hierarchy for admins in my application, but im unable to implement both baum and laravel inbuilt authentication toghether. because admin table extends Authenticable Class and for baum to work it needs to extend Baum\Node Class.
How do i achieve this?
Any help is appriciated, thankyou!

What did you do about it?
You could have done the following:
class User extends Node
implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract
{
use Authenticatable, Authorizable, CanResetPassword, SoftDeletes, Notifiable;
}

Related

How To Apply Laravel SoftDeletes on all Models at once?

Is there a way I can include use Illuminate\Database\Eloquent\SoftDeletes;
and use SoftDeletes; on all my Models without needing to edit each model?
I want some way to make my models import it automatically.
You can create abstract Model, and put there SoftDeletes and inherit other models from this abstract model.
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
abstract class AbstractModel extends Model
{
use SoftDeletes;
}
And for example User model will be:
namespace App\Models;
class User extends AbstractModel
{
}

User must implement CanResetPassword interface. Password Reset Laravel 5.4

password reset issue
User.php
namespace App;
use Eloquent;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Auth\Authenticatable as AuthenticableTrait;
class User extends Eloquent implements Authenticatable
{
use AuthenticableTrait;
Add the interface CanResetPassword to your User class:
// at the top of the file
use Illuminate\Auth\Passwords\CanResetPassword;
// at the class declaration
class User extends Eloquent implements Authenticatable, CanResetPassword
{
// ...
}

How to use "Jenssegers\Mongodb" in User model - Laravel 5.5

I want to use "Jenssegers\Mongodb" package in a Laravel 5.5 app.
The package documentation tells to use:
use Jenssegers\Mongodb\Eloquent\Model;
class User extends Model {}
instead of:
use Illuminate\Database\Eloquent\Model;
class User extends Model {}
But, inUser model:
class User extends Authenticatable{}
and in "Illuminate\Foundation\Auth\User" class (what 'Authenticatable' refers to) it's using Illuminate\Database\Eloquent\Model not Jenssegers\Mongodb\Eloquent\Model.
I found this solution to extend what 'Authenticatable' extends directly in my model instead of extending 'Authenticatable' itself, so that I can use Jenssegers\Mongodb\Eloquent\Model;
Is there another better solution or should I make it like that??
use Jenssegers\Mongodb\Auth\User as Authenticatable;
then
class User extends Authenticatable

Laravel ardent with authenticatable user model

May be simple question, but still I don't understand the concept behind it,
I should use,
use LaravelArdent\Ardent\Ardent;
class User extends Ardent {}
with Authenticatable class, now I have like this class User extends Authenticatable {}
How can I achieve this together?
Since the current version of Ardent doesn't provide any traits and by definition, you cannot have a class that extends two base classes, I would suggest moving the implementation from the Laravel User class (Illuminate/Foundation/Auth/User) into your model and extending LaravelArdent\Ardent\Ardent.
The code below should suffice but it has not been tested:
use LaravelArdent\Ardent\Ardent;
use Illuminate\Auth\Authenticatable;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends Ardent implements
AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract
{
use Authenticatable, Authorizable, CanResetPassword;
}

Laravel 5 Permiso

I am trying to implement this package in Laravel 5:
https://github.com/ricardoriogo/Permiso
I have followed the instructions and the package has installed correctly but I am unable to get it to work.
I am required to add the UserRolesTrait to the User model like so:
class User extends Model implements AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract
{
use Authenticatable, Authorizable, CanResetPassword;
use Riogo\Permiso\UserRolesTrait;
...
}
but when I run a simple migration it tells me Trait 'App\Models\Riogo\Permiso\UserRolesTrait' not found. Why not?
L5 doesn't seem to know where the file is.
Any ideas?

Categories