Skip to content

Commit 4d06dc1

Browse files
committed
customer controller implemented
1 parent ae782b4 commit 4d06dc1

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
}

app/Providers/AppServiceProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace App\Providers;
44

5+
use App\Repositories\Customer\CustomerRepo;
6+
use App\Repositories\Customer\ICustomerRepo;
57
use Illuminate\Support\ServiceProvider;
68

79
class 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
}

routes/web.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@
1414
Route::get('/', function () {
1515
return view('welcome');
1616
});
17+
18+
Route::get('/customers/getAll', 'CustomerController@getAll');

0 commit comments

Comments
 (0)