public function store($groupId)
 {
     $date = Input::get('date');
     $time = Input::get('time');
     try {
         DB::transaction(function () use($groupId, $date, $time) {
             foreach (Input::get('customers') as $customerId) {
                 $att = new \App\Attendance(['group_id' => $groupId, 'customer_id' => $customerId, 'was_at' => sprintf('%s %s', $date, $time)]);
                 $att->save();
             }
         });
     } catch (Exception $e) {
         redirect(route('attendance.index', $groupId))->with('error', $e->getMessage());
     }
     return redirect(route('attendance.index', $groupId))->with('status', 'Attendance saved');
 }
示例#2
0
                    <div class="bloc_info"><img src="{{  asset('images/enfants.png') }}" ><span class="count">
                            {{   App\Child::where('user_id',\Auth::user()->id)->count() }}
                        </span><p>Enfants inscrits</p></div>
                </a></div>
        </section>
    </div>
    <div class="col-md-4">
        <section class="panel bloc">
            <div class="panel-body">
                <a href="{{ action('AttendancesController@index') }}">
                    <div class="bloc_info"><img src="images/pointages.png" ><span class="count">

                         <?php 
$c = App\Child::where('user_id', \Auth::user()->id)->get();
if (!$c->isEmpty()) {
    echo App\Attendance::where('title', 'Absence')->whereRaw('EXTRACT(DAY FROM start) = ?', [\Carbon\Carbon::now()->day])->whereRaw('EXTRACT(YEAR FROM start) = ?', [\Carbon\Carbon::now()->year])->count();
}
?>
                        </span><p>Absents aujourd'hui</p></div></a>
            </div>
        </section>
    </div>
    @endif
    <div class="col-md-4">
        <section class="panel bloc horloge">
            <div class="panel-body">
                <?php 
/*setlocale(LC_ALL, 'fra_fra');
    $user = new App\User();
    $user->name = 'oblivius';
    $user->email = '*****@*****.**';