Repository: laravel/framework (php)

Issue:
Laravel 8 component @props not setting prop value
- Laravel Version: 8.20.1
- PHP Version: 8.0.1
- Database Driver & Version: N/A

### Description:
`@props` removes `disabled` from `$attributes`, but does not set `$disabled` value to true.

### Steps To Reproduce:

File: `resources/views/home.blade.php`  
```
<x-form-input type="text" :disabled="true" />
```

File: `resources/views/components/form-input.blade.php`  
```
<x-input :attributes="$attributes" />
```

File: `resources/views/components/input.blade.php`
```
@props(['disabled' => false])

@php
dd([
    'disabled' => $disabled,
    'attributes' => $attributes,
]);

$class = 'border-gray-300';
$classDisabled = 'border-gray-300 bg-gray-50 text-gray-500';

if ($disabled) {
    $class = $classDisabled;
}
@endphp

<input {{ $attributes->merge(['class' => $class]) }} {{ $disabled ? 'disabled' : '' }}/>
```

Output:
```
array:2 [▼
  "disabled" => false
  "attributes" => Illuminate\View\ComponentAttributeBag {#1501 ▼
    #attributes: array:1 [▼
      "type" => "text"
    ]
  }
]
```



Pull request description:
Fix attribute nesting on anonymous components
Fixes #36236 

Patch:
diff --git a/src/Illuminate/Support/Facades/File.php b/src/Illuminate/Support/Facades/File.php
index 2dfad0b2fd..13cfdde63c 100755
--- a/src/Illuminate/Support/Facades/File.php
+++ b/src/Illuminate/Support/Facades/File.php
@@ -40,6 +40,7 @@
  * @method static string|false mimeType(string $path)
  * @method static void ensureDirectoryExists(string $path, int $mode = 0755, bool $recursive = true)
  * @method static void link(string $target, string $link)
+ * @method static \Illuminate\Support\LazyCollection lines(string $path)
  * @method static void relativeLink(string $target, string $link)
  * @method static void replace(string $path, string $content)
  *
diff --git a/src/Illuminate/View/AnonymousComponent.php b/src/Illuminate/View/AnonymousComponent.php
index 516bc9ebee..2fb21e1afc 100644
--- a/src/Illuminate/View/AnonymousComponent.php
+++ b/src/Illuminate/View/AnonymousComponent.php
@@ -50,6 +50,11 @@ public function data()
     {
         $this->attributes = $this->attributes ?: $this->newAttributeBag();
 
-        return $this->data + ['attributes' => $this->attributes];
+        return array_merge(
+            optional($this->data['attributes'] ?? null)->getAttributes() ?: [],
+            $this->attributes->getAttributes(),
+            $this->data,
+            ['attributes' => $this->attributes]
+        );
     }
 }


Test patch:
diff --git a/tests/Integration/View/BladeTest.php b/tests/Integration/View/BladeTest.php
index 864a041f5d..b3d57f8f77 100644
--- a/tests/Integration/View/BladeTest.php
+++ b/tests/Integration/View/BladeTest.php
@@ -69,6 +69,13 @@ public function test_appendable_attributes()
 </div>', trim($view));
     }
 
+    public function tested_nested_anonymous_attribute_proxying_works_correctly()
+    {
+        $view = View::make('uses-child-input')->render();
+
+        $this->assertSame('<input class="disabled-class" foo="bar" type="text" disabled />', trim($view));
+    }
+
     protected function getEnvironmentSetUp($app)
     {
         $app['config']->set('view.paths', [__DIR__.'/templates']);
diff --git a/tests/Integration/View/templates/components/base-input.blade.php b/tests/Integration/View/templates/components/base-input.blade.php
new file mode 100644
index 0000000000..4d8f09367c
--- /dev/null
+++ b/tests/Integration/View/templates/components/base-input.blade.php
@@ -0,0 +1,11 @@
+@props(['disabled' => false])
+
+@php
+if ($disabled) {
+    $class = 'disabled-class';
+} else {
+    $class = 'not-disabled-class';
+}
+@endphp
+
+<input {{ $attributes->merge(['class' => $class]) }} {{ $disabled ? 'disabled' : '' }} />
\ No newline at end of file
diff --git a/tests/Integration/View/templates/components/child-input.blade.php b/tests/Integration/View/templates/components/child-input.blade.php
new file mode 100644
index 0000000000..711e20d4e6
--- /dev/null
+++ b/tests/Integration/View/templates/components/child-input.blade.php
@@ -0,0 +1,1 @@
+<x-base-input foo="bar" :attributes="$attributes" />
\ No newline at end of file
diff --git a/tests/Integration/View/templates/uses-child-input.blade.php b/tests/Integration/View/templates/uses-child-input.blade.php
new file mode 100644
index 0000000000..bc5bdade5d
--- /dev/null
+++ b/tests/Integration/View/templates/uses-child-input.blade.php
@@ -0,0 +1,1 @@
+<x-child-input type="text" :disabled="true" />
\ No newline at end of file