Blame view

app/Http/ViewComposers/Index.php 649 Bytes
b7c7a5f6   Alexey Boroda   first commit
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
  <?php
  
  namespace App\Http\ViewComposers;
  
  use Date;
  use Illuminate\View\View;
  
  class Index
  {
      /**
       * Bind data to the view.
       *
       * @param  View  $view
       * @return void
       */
      public function compose(View $view)
      {
          $limits = ['10' => '10', '25' => '25', '50' => '50', '100' => '100'];
  
          $now = Date::now();
  
          $this_year = $now->year;
  
          $years = [];
          $y = $now->addYears(2);
          for ($i = 0; $i < 10; $i++) {
              $years[$y->year] = $y->year;
              $y->subYear();
          }
  
          $view->with(['limits' => $limits, 'this_year' => $this_year, 'years' => $years]);
      }
  }