Repository: statamic-rad-pack/runway (php)

Issue:
The method AugmentedModel::wrapModelAccessor resolves Attribute getter without passing params $value and $attributes
### Description

On this line [AugmentedModel.php#L189](https://github.com/statamic-rad-pack/runway/blob/3bb86435aac2a8e351bfcc42f8d6f019eb58e7d2/src/Data/AugmentedModel.php#L189) the attribute getter is called without passing any params. This causes the method to break when one of those params is required.

Changing the method to something like this resolves the issue:
```
$attributes = $this->data->getAttributes();
return ($attribute->get)($attributes[$handle], $attributes);
```

Before I open an PR I wanted to check if this was setup like this intentionally. 

### Steps to reproduce

1. Create a model with an Attribute that uses a getter whit an value, for example:
```php
 public function slug(): Attribute
    {
        return Attribute::make(
            set: function($input) {
                $slug = Str::slug($input);
                $found = 0;
                while (Club::where('slug', '=', $slug)->count()) {
                    $found++;
                    $slug = Str::slug($input . "-{$found}");
                }

                return $slug;
            },
            get: fn (?string $value) => $value,
        );
    }
```
2. Do something that creates the `AugmentedModel`. For example in a entry that has a Runway model (`$my_model`) linked trough an `BelongsTo` field.
```
{{ $my_model->value() }}
```
calling `->value()` causes the method to break as it is creating the AugmentedModel.

### Environment

Environment
Laravel Version: 11.20.0
PHP Version: 8.3.12
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: nl

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Livewire
Livewire: v3.5.4

Sentry
Enabled: MISSING DSN
Environment: local
Laravel SDK Version: 4.8.0
PHP SDK Version: 4.9.0
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: NOT SET
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED

Statamic
Addons: 6
Sites: 2 (Nederlands, Engels)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.22.0 PRO

Statamic Addons
alt-design/alt-redirect: 1.3.2
alt-design/alt-seo: 1.2.1
alt-design/alt-sitemap: 1.2.2
doefom/currency-fieldtype: 1.4.1
statamic-rad-pack/runway: dev-morphmany
statamic/eloquent-driver: 4.15.2

Statamic Eloquent Driver
Asset Containers: file
Assets: eloquent
Blueprints: file
Collection Trees: eloquent
Collections: file
Entries: eloquent
Forms: file
Global Sets: file
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: file
Revisions: file
Sites: file
Taxonomies: file
Terms: eloquent
Tokens: eloquent

Pull request description:
[7.x] Fix error when augmenting model mutators
Fixes #627 

Passes the `$value` and `$attributes` values to the models Attributes getter.

Patch:
diff --git a/src/Data/AugmentedModel.php b/src/Data/AugmentedModel.php
index d424e9b..e976225 100644
--- a/src/Data/AugmentedModel.php
+++ b/src/Data/AugmentedModel.php
@@ -9,6 +9,7 @@ use Statamic\Data\AbstractAugmented;
 use Statamic\Fields\Field;
 use Statamic\Fields\Value;
 use Statamic\Statamic;
+use Statamic\Support\Arr;
 use StatamicRadPack\Runway\Runway;
 
 class AugmentedModel extends AbstractAugmented
@@ -186,7 +187,9 @@ class AugmentedModel extends AbstractAugmented
                     return $this->data->getAttribute($handle);
                 }
 
-                return ($attribute->get)();
+                $attributes = $this->data->getAttributes();
+
+                return ($attribute->get)(Arr::get($attributes, $handle), $attributes);
             },
             $handle,
             $this->fieldtype($handle),


Test patch:
diff --git a/tests/Data/AugmentedModelTest.php b/tests/Data/AugmentedModelTest.php
index 889d614..0ecb3d8 100644
--- a/tests/Data/AugmentedModelTest.php
+++ b/tests/Data/AugmentedModelTest.php
@@ -81,4 +81,14 @@ class AugmentedModelTest extends TestCase
 
         $this->assertEquals('This is an appended value.', $augmented->get('appended_value')->value());
     }
+
+    #[Test]
+    public function it_gets_value_from_mutator()
+    {
+        $post = Post::factory()->create(['mutated_value' => 'Foo']);
+
+        $augmented = new AugmentedModel($post);
+
+        $this->assertEquals('Foo is a mutated value.', $augmented->get('mutated_value')->value());
+    }
 }
diff --git a/tests/__fixtures__/app/Models/Post.php b/tests/__fixtures__/app/Models/Post.php
index 2d6b979..258d614 100644
--- a/tests/__fixtures__/app/Models/Post.php
+++ b/tests/__fixtures__/app/Models/Post.php
@@ -15,7 +15,7 @@ class Post extends Model
     use HasFactory, HasRunwayResource, RunwayRoutes;
 
     protected $fillable = [
-        'title', 'slug', 'body', 'values', 'external_links', 'author_id', 'sort_order', 'published',
+        'title', 'slug', 'body', 'values', 'external_links', 'author_id', 'sort_order', 'published', 'mutated_value',
     ];
 
     protected $appends = [
@@ -71,6 +71,13 @@ class Post extends Model
         );
     }
 
+    public function mutatedValue(): Attribute
+    {
+        return Attribute::make(
+            get: fn (string $value, array $attributes) => "{$value} is a mutated value.",
+        );
+    }
+
     public function searchMethod()
     {
         return 'This is a value returned from a method';
diff --git a/tests/__fixtures__/database/factories/PostFactory.php b/tests/__fixtures__/database/factories/PostFactory.php
index 58f1e5a..a6441dd 100644
--- a/tests/__fixtures__/database/factories/PostFactory.php
+++ b/tests/__fixtures__/database/factories/PostFactory.php
@@ -29,6 +29,7 @@ class PostFactory extends Factory
             'body' => implode(' ', $this->faker->paragraphs(10)),
             'author_id' => Author::factory()->create()->id,
             'published' => true,
+            'mutated_value' => 'Foo',
         ];
     }
 
diff --git a/tests/__fixtures__/database/migrations/2020_12_12_220453_create_posts_table.php b/tests/__fixtures__/database/migrations/2020_12_12_220453_create_posts_table.php
index f1faa88..b81171d 100644
--- a/tests/__fixtures__/database/migrations/2020_12_12_220453_create_posts_table.php
+++ b/tests/__fixtures__/database/migrations/2020_12_12_220453_create_posts_table.php
@@ -25,6 +25,7 @@ class CreatePostsTable extends Migration
             $table->datetime('start_date')->nullable();
             $table->datetime('end_date')->nullable();
             $table->boolean('published')->default(false);
+            $table->string('mutated_value')->nullable();
             $table->timestamps();
         });
     }