|
1
|
|
|
<?php |
|
2
|
|
|
use Illuminate\Http\Request; |
|
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
|-------------------------------------------------------------------------- |
|
5
|
|
|
| Routes File |
|
6
|
|
|
|-------------------------------------------------------------------------- |
|
7
|
|
|
| |
|
8
|
|
|
| Here is where you will register all of the routes in an application. |
|
9
|
|
|
| It's a breeze. Simply tell Laravel the URIs it should respond to |
|
10
|
|
|
| and give it the controller to call when that URI is requested. |
|
11
|
|
|
| |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
/* |
|
17
|
|
|
|-------------------------------------------------------------------------- |
|
18
|
|
|
| Application Routes |
|
19
|
|
|
|-------------------------------------------------------------------------- |
|
20
|
|
|
| |
|
21
|
|
|
| This route group applies the "web" middleware group to every route |
|
22
|
|
|
| it contains. The "web" middleware group is defined in your HTTP |
|
23
|
|
|
| kernel and includes session state, CSRF protection, and more. |
|
24
|
|
|
| |
|
25
|
|
|
*/ |
|
26
|
|
|
Route::group(['middleware' => 'web'],function(){ |
|
27
|
|
|
Route::get('admin',['middleware'=>['auth','admin'],'uses'=>'AdminController@index']); |
|
28
|
|
|
Route::get('admin/users',['middleware'=>'auth','as' => 'users', 'uses'=>'AdminController@users']); |
|
29
|
|
|
Route::get('admin/users/{id}',['middleware'=>'auth','as' => 'users_id', 'uses'=>'AdminController@users_id']); |
|
30
|
|
|
Route::post('admin/users/{id}',['middleware'=>'auth','as' => 'users_id_post', 'uses'=>'AdminController@users_id_post']); |
|
31
|
|
|
Route::get('admin/users/{id}/delete',['middleware'=>'auth','as' => 'users_delete', 'uses'=>'AdminController@users_delete']); |
|
32
|
|
|
Route::get('profile',['middleware' => 'auth','uses'=>'UserController@index']); |
|
33
|
|
|
Route::post('password','UserController@change'); |
|
34
|
|
|
Route::post('information/{id}','UserController@info'); |
|
35
|
|
|
Route::get('empty','MainController@empty1'); |
|
36
|
|
|
Route::get('category','CategoryController@index'); |
|
37
|
|
|
Route::get('category/edit/{id}','CategoryController@edit'); |
|
38
|
|
|
Route::post('category/{id}','CategoryController@update'); |
|
39
|
|
|
Route::get('category/delete/{id}','CategoryController@destroy'); |
|
40
|
|
|
Route::get('categories/create','CategoryController@create'); |
|
41
|
|
|
Route::post('categories','CategoryController@store'); |
|
42
|
|
|
Route::post('backer_update/{id}','BackerController@update'); |
|
43
|
|
|
Route::resource('backer','BackerController'); |
|
44
|
|
|
Route::post('creator_update/{id}','AdminCreatorController@update'); |
|
45
|
|
|
Route::get('creator_delete/{id}','AdminCreatorController@destroy'); |
|
46
|
|
|
Route::resource('creators','AdminCreatorController'); |
|
47
|
|
|
}); |
|
48
|
|
|
Route::group(array('before' => 'admin'), function(){ |
|
49
|
|
|
}); |
|
50
|
|
|
Route::group(['middleware' => 'web'], function () { |
|
51
|
|
|
Route::auth(); |
|
52
|
|
|
Route::get('/','ProjectController@index'); |
|
53
|
|
|
Route::get('/creator',['middleware'=>'auth','uses'=>'CreatorController@index']); |
|
54
|
|
|
Route::post('/creator/add','CreatorController@add'); |
|
55
|
|
|
Route::get('/new',['middleware'=>'auth','uses'=>'ProjectController@add_new']); |
|
56
|
|
|
Route::get('/random', ['middleware'=>'auth', 'uses' => 'ProjectController@random']); |
|
57
|
|
|
Route::get('/archive','ProjectController@archive'); |
|
58
|
|
|
Route::get('/redirect', 'SocialAuthController@redirect'); |
|
59
|
|
|
Route::get('/callback', 'SocialAuthController@callback'); |
|
60
|
|
|
|
|
61
|
|
|
Route::get('/about', function () { |
|
62
|
|
|
return view('about'); |
|
63
|
|
|
}); |
|
64
|
|
|
|
|
65
|
|
|
Route::get('/project','ProjectController@update'); |
|
66
|
|
|
|
|
67
|
|
|
Route::post('/create','ProjectController@create'); |
|
68
|
|
|
Route::get('/edit/{id}','ProjectController@edit'); |
|
69
|
|
|
//Route::post('/update/{id}','ProjectController@update'); |
|
|
|
|
|
|
70
|
|
|
Route::get('/delete/{id}','ProjectController@delete'); |
|
71
|
|
|
Route::post('/store','ProjectController@store'); |
|
72
|
|
|
Route::get('/show/{id}','ProjectController@show')->where(['id'=>'[0-9]+']); |
|
73
|
|
|
|
|
74
|
|
|
Route::get('/bookmark/{id}',['middleware'=>'auth','uses'=>'BookmartController@add'])->where(['id'=>'[0-9]+']); |
|
75
|
|
|
Route::get('/bookmark/delete/{id}','BookmartController@add')->where(['id'=>'[0-9]+']); |
|
76
|
|
|
|
|
77
|
|
|
Route::get('/settings', function () { |
|
78
|
|
|
return view('settings'); |
|
79
|
|
|
}); |
|
80
|
|
|
|
|
81
|
|
|
Route::post('/search','SearchController@search'); |
|
82
|
|
|
|
|
83
|
|
|
// Route::get('comment/{id}','ProjectController@comment'); |
|
|
|
|
|
|
84
|
|
|
Route::post('comment/{id}',['middleware'=>'auth','as'=>'commentPost','uses'=>'ProjectController@commentPost']); |
|
85
|
|
|
|
|
86
|
|
|
Route::get('by_category/{id}','ProjectController@ByCategory'); |
|
87
|
|
|
Route::get('moderator',['middleware' => ['auth','moder'],'uses'=>'Moderator\ModerController@index']); |
|
88
|
|
|
Route::group(['prefix' => 'moderator','middleware'=>'moder'] ,function(){ |
|
89
|
|
|
Route::resource('project','Moderator\ProjectController'); |
|
90
|
|
|
}); |
|
91
|
|
|
}); |
|
92
|
|
|
|
Let’s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let’s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: