Merge branch 'feature/EditProfileBugFix' into 'develop'
return the full path of avatar See merge request witelgroup/rms_v2!16
This commit is contained in:
@@ -29,7 +29,7 @@ class ProfileController extends Controller
|
||||
'major' => $user->major,
|
||||
'degree' => $user->degree,
|
||||
'mobile' => $user->mobile,
|
||||
'avatar' => $user->avatar,
|
||||
'avatar' => $user->avatarUrl()
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
use Spatie\Permission\Traits\HasPermissions;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
@@ -24,7 +25,7 @@ class User extends Authenticatable
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password', 'username', 'first_name', 'last_name', 'position', 'mobile', 'province_id', 'city_id', 'confirmed', 'enabled', 'avatar', 'city_fa', 'province_fa', 'degree'
|
||||
'name', 'email', 'major', 'password', 'username', 'first_name', 'last_name', 'position', 'mobile', 'province_id', 'city_id', 'confirmed', 'enabled', 'avatar', 'city_fa', 'province_fa', 'degree'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -228,4 +229,10 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadConstructionRural');
|
||||
}
|
||||
|
||||
public function avatarUrl(): ?string
|
||||
{
|
||||
$avatar = $this->attributes['avatar'];
|
||||
return $avatar == null ? null : Storage::disk('public')->url($avatar);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user