File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace App \Http \Controllers ;
4
+
5
+ use Illuminate \Http \Request ;
6
+
7
+ class HomeController extends Controller
8
+ {
9
+ /**
10
+ * Create a new controller instance.
11
+ *
12
+ * @return void
13
+ */
14
+ public function __construct ()
15
+ {
16
+ $ this ->middleware ('auth ' );
17
+ }
18
+
19
+ /**
20
+ * Show the application dashboard.
21
+ *
22
+ * @return \Illuminate\Contracts\Support\Renderable
23
+ */
24
+ public function index ()
25
+ {
26
+
27
+ if (auth ()->user ()->is_admin ==1 ){
28
+ return redirect ()->to ('auth/dashboard ' );
29
+ }
30
+ return redirect ()->to ('/ ' );
31
+
32
+ }
33
+ }
Original file line number Diff line number Diff line change 4
4
use App \Http \Controllers \FrontProductListController ;
5
5
use App \Http \Controllers \CartController ;
6
6
use App \Http \Controllers \ProductController ;
7
+ use App \Http \Controllers \HomeController ;
7
8
8
9
// Route::get('/', 'FrontProductListController@index');
9
10
Route::get ('/ ' , [FrontProductListController::class, 'index ' ]);
22
23
// Auth::routes();
23
24
24
25
Route::get ('all/products ' , [FrontProductListController::class, 'moreProducts ' ])->name ('more.product ' );
25
- // Route::get('/home', ' HomeController@ index')->name('home');
26
+ Route::get ('/home ' , [ HomeController::class, ' index '] )->name ('home ' );
26
27
// Route::get('subcatories/{id}', 'ProductController@loadSubCategories');
27
28
28
29
Route::get ('/dashboard ' , function () {
29
- return view ( ' dashboard ' );
30
+ return redirect ( ' / ' );
30
31
})->middleware (['auth ' , 'verified ' ])->name ('dashboard ' );
31
32
32
33
// Route::middleware('auth')->group(function () {
You can’t perform that action at this time.
0 commit comments