Repository: laravel/framework (php)

Issue:
The issue is a new pattern of Attribute Cast
I'm using the new version of `Attribute Cast` in the Laravel version: 8.77 but showed this error when logged in authorization with guard admin 

- Laravel Version: 8.77.1
- PHP Version: 8.0

### Error:
![image](https://user-images.githubusercontent.com/46572405/147882230-c67acc1d-1056-464d-8043-edd094bd25ed.png)

### Model Admin:
```php
<?php

namespace App\Models\Tenant;

use Illuminate\Database\Eloquent\Casts\Attribute;

class Admin extends Authenticatable
{
    use Notifiable, HasRoles, SoftDeletes;

    /**
     * The authentication guard name.
     *
     * @var string
     */
    public $guard = 'admin';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name',
        'email',
        'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password',
        'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
    
    /**
     * Set the admin's Hash password.
     *
     * @return Attribute
     */
    protected function password(): Attribute
    {
        return new Attribute(
            set: fn($value) => Hash::make($value),
        );
    }
}


Pull request:
[8.x] Fix attribute casting
Fixes an oversight in https://github.com/laravel/framework/pull/40022.

At the moment when you omit a get cast with the new attribute casting, the attribute call will propagate through the getAttribute method and end up to getRelationValue which will throw an exception that the attribute isn't a relationship instance. This is because the way attribute calls work is to fallback on relationships when they're not available. So the way the checks are done on get/set callables with the new attribute casting isn't entirely correct. We should omit the callable checks and just check if the method that corresponds with the requested attribute is returning an Attribute cast instance. If that's the case we can assume the user wanted to use attribute casting, regardless of a getter/setter being available or not. 

A cavaet of this is that this will prevent the call to continue to class casts and the old date casting. I do not know how to solve this and would appreciate any insights you have @taylorotwell.

Fixes #40230


Patch:
diff --git a/CHANGELOG-6.x.md b/CHANGELOG-6.x.md
index d23df8702d..bee563d1db 100644
--- a/CHANGELOG-6.x.md
+++ b/CHANGELOG-6.x.md
@@ -1,6 +1,15 @@
 # Release Notes for 6.x
 
-## [Unreleased](https://github.com/laravel/framework/compare/v6.20.42...6.x)
+## [Unreleased](https://github.com/laravel/framework/compare/v6.20.43...6.x)
+
+
+## [v6.20.43 (2021-12-14)](https://github.com/laravel/framework/compare/v6.20.42...v6.20.43)
+
+### Fixed
+- Fixed inconsistent escaping of artisan argument ([#39953](https://github.com/laravel/framework/pull/39953))
+
+### Changed
+- Do not return anything `Illuminate/Foundation/Application::afterLoadingEnvironment()`
 
 
 ## [v6.20.42 (2021-12-07)](https://github.com/laravel/framework/compare/v6.20.41...v6.20.42)
diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
index 8daf2d95c7..8833cb42b7 100644
--- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
+++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
@@ -571,8 +571,7 @@ public function hasAttributeGetMutator($key)
 
         return static::$attributeMutatorCache[get_class($this)][$key] = $returnType &&
                     $returnType instanceof ReflectionNamedType &&
-                    $returnType->getName() === Attribute::class &&
-                    is_callable($this->{$method}()->get);
+                    $returnType->getName() === Attribute::class;
     }
 
     /**
@@ -949,8 +948,7 @@ public function hasAttributeSetMutator($key)
 
         return static::$setAttributeMutatorCache[$class][$key] = $returnType &&
                     $returnType instanceof ReflectionNamedType &&
-                    $returnType->getName() === Attribute::class &&
-                    is_callable($this->{$method}()->set);
+                    $returnType->getName() === Attribute::class;
     }
 
     /**


Test patch:
diff --git a/tests/Integration/Database/DatabaseEloquentModelAttributeCastingTest.php b/tests/Integration/Database/DatabaseEloquentModelAttributeCastingTest.php
index e666bdafc8..fc2e8df34c 100644
--- a/tests/Integration/Database/DatabaseEloquentModelAttributeCastingTest.php
+++ b/tests/Integration/Database/DatabaseEloquentModelAttributeCastingTest.php
@@ -142,6 +142,8 @@ public function testOneWayCasting()
     {
         $model = new TestEloquentModelWithAttributeCast;
 
+        $this->assertNull($model->password);
+
         $model->password = 'secret';
 
         $this->assertEquals(hash('sha256', 'secret'), $model->password);