author | ymh <ymh.work@gmail.com> |
Thu, 10 Nov 2016 01:45:47 +0100 | |
changeset 408 | c89c11c2def7 |
parent 327 | 13564bb13ccc |
permissions | -rw-r--r-- |
327
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
<?php |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
|
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
namespace CorpusParole\Providers; |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
|
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
use Illuminate\Support\ServiceProvider; |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
use Illuminate\Pagination\PaginationServiceProvider as BasePaginationServiceProvider; |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
use Illuminate\Pagination\Paginator; |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
|
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
use Log; |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
|
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
class PaginationServiceProvider extends BasePaginationServiceProvider |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
{ |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
|
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
/** |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
* Register the application services. |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
* |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
* @return void |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
*/ |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
public function register() |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
{ |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
parent::register(); |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
Paginator::currentPathResolver(function () { |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
$r = $this->app['request']; |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
$queryParams = $r->all(); |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
unset($queryParams[config('corpusparole.pagination_page_param')]); |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
|
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
$question = $r->getBaseUrl().$r->getPathInfo() == '/' ? '/?' : '?'; |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
return $r->url().$question.http_build_query($queryParams); |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
}); |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
30 |
|
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
31 |
} |
13564bb13ccc
In the serialized document the lan files id 'languages' and not 'language'
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
32 |
} |