Exemple #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $tester = \App\User::where('username', '=', 'Tester')->first();
     $admin = \App\User::where('username', '=', 'Super Admin')->first();
     $site = new \App\Site();
     $site->name = 'Global';
     $site->domain = 'parent.com';
     $site->save();
     $admin->sites()->attach($site->id);
     $site = new \App\Site();
     $site->name = 'Idaho Press-Tribune';
     $site->domain = 'idahopress.com';
     $site->save();
     $admin->sites()->attach($site->id);
     $site = new \App\Site();
     $site->name = 'Idaho State Journal';
     $site->domain = 'idahostatejournal.com';
     $site->save();
     $tester->sites()->attach($site->id);
     $admin->sites()->attach($site->id);
 }
Exemple #2
0
 public function checkIfRole($site, $role)
 {
     if (!is_int($site)) {
         $site = App\Site::where('slug', $site)->first()->id;
     }
     return $this->siteUser()->whereHas('role', function ($q) {
         $q->where('name', $role);
     })->count();
 }
Exemple #3
0
        <thead>
            <tr>
                <th>Περιφέρεια</th>
                <th>Πλήθος Υποψ.</th>
            </tr>
        </thead>
        
        <tbody>
            @foreach($districts as $district_id => $district_name)
                @if($district_id != '')
                    <tr>
                        <td>{{ $district_name }}</td>
                        <td>{{ App\Site::where('district_id', '=', $district_id)->count() }}</td>
                    </tr>
                    <?php 
$districts_count += App\Site::where('district_id', '=', $district_id)->count();
?>
                
                    <script>
                        var district_name = "{{ $district_name }}",
                            district_count = {{ App\Site::where('district_id', '=', $district_id)->count() }};
                        district_names.push(district_name);
                        district_counts.push(district_count);
                    </script>
                @endif
            @endforeach
        </tbody>
    </table>

    <p class="lead">Σύνολο: <strong>{{ $districts_count }}</strong></p>