You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This command will create a HomeController within the app/Http/Controllers/Dashboard directory.
65
+
66
+
#### Basic View Creation:
67
+
If you want to create a view in a subdirectory like dashboard, you can specify the directory structure as part of the view name:
68
+
69
+
```bash
70
+
php artisan make:view dashboard.home
71
+
```
72
+
73
+
This command will create a home.blade.php view within the `resources/views/dashboard` directory.
74
+
75
+
76
+
## Step 4: Routes defined
77
+
78
+
Your provided routes are attempting to define routes in Laravel, pointing to specific controller actions. Here's an explanation of the routes you've written:
Make sure you have the corresponding controllers and methods created:
90
+
91
+
- For the HomeController, there should be a file at `app/Http/Controllers/HomeController.php` with an index method.
92
+
93
+
For the `Dashboard\HomeController` there should be a file at
94
+
95
+
- app/Http/Controllers/Dashboard/HomeController.php with a dashboard method.
96
+
97
+
Also, ensure that the controllers are correctly namespaced. If your controllers are not in the default namespace, you should adjust the use statement at the top of your routes file accordingly.
98
+
99
+
Here's an example of how the controllers might be structured:
100
+
101
+
```bash
102
+
// HomeController.php
103
+
namespace App\Http\Controllers;
104
+
105
+
class HomeController extends Controller
106
+
{
107
+
public function index()
108
+
{
109
+
#/yourproject/config/layout-assets.php
110
+
# You can add more as per your requirement
111
+
# ex addWebAsset(['home', '', '']);
112
+
addWebAsset(['home']);
113
+
return view('home');
114
+
}
115
+
}
116
+
117
+
// Dashboard/HomeController.php
118
+
namespace App\Http\Controllers\Dashboard;
119
+
120
+
class HomeController extends Controller
121
+
{
122
+
public function dashboard()
123
+
{
124
+
#/yourproject/config/layout-assets.php
125
+
# You can add more as per your requirement
126
+
# ex addVendors(['demo', '', '']);
127
+
addVendors(['demo']);
128
+
return view('dashboard.home');
129
+
}
130
+
}
131
+
```
132
+
133
+
## Step 5: Use layout
134
+
- Then, you can use this component in your `home.blade.php` or `dashboard/home.blade.php` view:
0 commit comments