File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Http \Controllers ;
4+
5+ use App \Repositories \Customer \ICustomerRepo ;
6+
7+ class CustomerController extends Controller
8+ {
9+ protected $ repo ;
10+
11+ public function __construct (ICustomerRepo $ repo )
12+ {
13+ $ this ->repo = $ repo ;
14+ }
15+
16+ public function getAll ()
17+ {
18+ return $ this ->repo ->getAll ();
19+ }
20+ }
Original file line number Diff line number Diff line change 22
33namespace App \Providers ;
44
5+ use App \Repositories \Customer \CustomerRepo ;
6+ use App \Repositories \Customer \ICustomerRepo ;
57use Illuminate \Support \ServiceProvider ;
68
79class AppServiceProvider extends ServiceProvider
@@ -23,6 +25,6 @@ public function boot()
2325 */
2426 public function register ()
2527 {
26- //
28+ $ this -> app -> singleton (ICustomerRepo::class, CustomerRepo::class);
2729 }
2830}
Original file line number Diff line number Diff line change 1414Route::get ('/ ' , function () {
1515 return view ('welcome ' );
1616});
17+
18+ Route::get ('/customers/getAll ' , 'CustomerController@getAll ' );
You can’t perform that action at this time.
0 commit comments