-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRouteServiceProvider.php
54 lines (48 loc) · 1.49 KB
/
RouteServiceProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Matchappen\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Matchappen\Occupation;
use Matchappen\Workplace;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to the controller routes in your routes file.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'Matchappen\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
parent::boot($router);
$router->model('user', 'Matchappen\User');
$router->model('opportunity', 'Matchappen\Opportunity');
$router->model('booking', 'Matchappen\Booking');
$router->bind('workplace', function($value) {
return Workplace::findBySlugOrIdOrFail($value);
});
$router->bind('occupation', function($value) {
return Occupation::findBySlugOrIdOrFail($value);
});
}
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace], function ($router) {
require app_path('Http/routes.php');
});
}
}