diff --git a/app/Http/Controllers/ScheduleController.php b/app/Http/Controllers/ScheduleController.php
index 33d62cd54f22d083021025b8922012c6615615bd..d400d5fd190f0ce79214243af40fa456a2495871 100644
--- a/app/Http/Controllers/ScheduleController.php
+++ b/app/Http/Controllers/ScheduleController.php
@@ -46,7 +46,7 @@ class ScheduleController extends Controller
         } 
         else 
         {
-            return view('menu.schedule',['data' => Schedule::where('id_user', Auth::user()->id)->get()]);
+            return view('menu.schedule', ['data' => Schedule::where('id_user', Auth::user()->id)->get()]);
         }
     }
 
@@ -77,7 +77,15 @@ class ScheduleController extends Controller
     {
         $sched = Schedule::find($id);
         $sched->update($input);
-        return $sched;
+
+        $tps = $sched->tps();
+        $tps->capacity_now += $sched->amount;
+        if ($tps->capacity_now >= $tps->capacity_full)
+        {
+            notify('TPS '.$tps->name.' penuh');
+        }
+
+        return redirect('/schedule');
     }
 
     public function destroy($id)
@@ -85,4 +93,16 @@ class ScheduleController extends Controller
         Schedule::find($id)->delete();
         return Schedule::all();
     }
+
+    public function notify($notif)
+    {
+        $data = [
+            'content' => $notif,
+        ];
+
+        Mail::send('emails.welcome', $data, function ($message) {
+            $message->from(env('MAIL_USERNAME', 'user@host.suffix'), 'Notifikasi');
+            $message->to($request->input('email'))->subject('Notifikasi Status TPS');
+        });
+    }
 }
\ No newline at end of file
diff --git a/app/Http/Controllers/TpsController.php b/app/Http/Controllers/TpsController.php
index b0eff5f7bcc8414f418a856acccf28a77fc6feea..223aed7270bdefb4299566a7faf81c562e50a860 100644
--- a/app/Http/Controllers/TpsController.php
+++ b/app/Http/Controllers/TpsController.php
@@ -53,17 +53,17 @@ class TpsController extends Controller
             $tmp->managerName = $tps->manager()->get(['name'])[0]->name;
             array_push($arr,$tmp);
         }
-        return view('menu.tps',['data' => $arr]);
+        return view('menu.tps', ['data' => $arr]);
     }
 
     public function store()
     {
         $tps = new Tps;
-        $tps->capacity_now = Input::get('capacity_now',0);
-        $tps->capacity_full = Input::get('capacity_full',0);
+        $tps->capacity_now = Input::get('capacity_now', 0);
+        $tps->capacity_full = Input::get('capacity_full', 0);
         $tps->nama = Input::get('name','');
-        $tps->is_full = Input::get('is_full',0);
-        $tps->id_manager = Input::get('idPengelola',0);
+        $tps->is_full = Input::get('is_full', 0);
+        $tps->id_manager = Input::get('idPengelola', 0);
         $tps->id = 0;
         $tps->save();
         //$tps = Tps::create(Input::all());
@@ -73,7 +73,9 @@ class TpsController extends Controller
     public function create()
     {
         // view create doang
-        return view('menu.insertTps',['dataManager' => User::all(['id','name'])]);
+        return view('menu.insertTps', [
+            'dataManager' => User::all(['id', 'name'])
+        ]);
     }
 
     public function show($id)
@@ -85,17 +87,21 @@ class TpsController extends Controller
     public function edit($id)
     {
         // viewnya pake form edit
-        return view('menu.editTps',['id'=>$id,'data' => Tps::find($id),'dataManager' => User::all(['id','name'])]);
+        return view('menu.editTps', [
+            'id' => $id, 
+            'data' => Tps::find($id),
+            'dataManager' => User::all(['id', 'name'])
+        ]);
     }
 
     public function update($id)
     {
         $tps = Tps::find($id);
-        $tps->capacity_now = Input::get('capacity_now',0);
-        $tps->capacity_full = Input::get('capacity_full',0);
-        $tps->nama = Input::get('name','');
-        $tps->is_full = Input::get('is_full',0);
-        $tps->id_manager = Input::get('idPengelola',0);
+        $tps->capacity_now = Input::get('capacity_now', 0);
+        $tps->capacity_full = Input::get('capacity_full', 0);
+        $tps->nama = Input::get('name', '');
+        $tps->is_full = Input::get('is_full', 0);
+        $tps->id_manager = Input::get('idPengelola', 0);
         $tps->save();
         return redirect('/tps');
     }
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 5b0ecdcc5cdd95c1c0d4cd7d526dc2d15ef6c8c0..14d6cf6f1284a96b15c4c64706fd164d2b8b7512 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -43,7 +43,7 @@ class UserController extends Controller
     
     public function index()
     {
-        return view('menu.user',['data' => User::all()]);
+        return view('menu.user', ['data' => User::all()]);
     }
 
     public function store()
@@ -70,7 +70,10 @@ class UserController extends Controller
     public function edit($id)
     {
         // viewnya pake form edit
-        return view('menu.editUser',['id'=>$id,'data' => User::find($id)]);
+        return view('menu.editUser', [
+            'id' => $id,
+            'data' => User::find($id)
+        ]);
     }
 
     public function update($id)
diff --git a/app/Http/routes.php b/app/Http/routes.php
index 558ea36c5fca6e7656671021480f70a57cd0fca5..a09cb5176bc3033fa8d282991419a750143eae56 100644
--- a/app/Http/routes.php
+++ b/app/Http/routes.php
@@ -13,6 +13,7 @@
 
 Route::group(['middleware' => 'web'], function () {
     Route::auth();
+
     Route::get('/', 'HomeController@index');              // homnya kan cm 1 
     Route::get('/home', 'HomeController@index');
 
diff --git a/app/UsersRoles.php b/app/UsersRoles.php
new file mode 100644
index 0000000000000000000000000000000000000000..10077fe0c88cbe8cbca3a8f098b7a5160ecf483e
--- /dev/null
+++ b/app/UsersRoles.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class UsersRoles extends Model
+{
+    public function user()
+    {
+        return $this->hasOne('App\User', 'id', 'id_user');
+    }
+
+    public function role()
+    {
+        return $this->hasOne('App\User', 'id', 'id_role');
+    }
+}
diff --git a/database/migrations/2016_04_04_055311_create_schedules_table.php b/database/migrations/2016_04_04_055311_create_schedules_table.php
index eccf548935dde7c5ff428d133226c2ac03aa3683..280d4f74827b55dbe6a2e9d23a510e8c0589587e 100644
--- a/database/migrations/2016_04_04_055311_create_schedules_table.php
+++ b/database/migrations/2016_04_04_055311_create_schedules_table.php
@@ -17,6 +17,7 @@ class CreateSchedulesTable extends Migration
             $table->increments('id');
             $table->integer('id_tps')->unsigned();
             $table->integer('id_user')->unsigned();
+            $table->integer('amount')->unsigned();
             $table->boolean('is_done');
             $table->timestamp('time');
             $table->timestamps();
diff --git a/resources/views/email/notification.blade.php b/resources/views/email/notification.blade.php
new file mode 100644
index 0000000000000000000000000000000000000000..ffecbccf5150a91a62ad03adf490ea385794953e
--- /dev/null
+++ b/resources/views/email/notification.blade.php
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset="utf-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <link rel="stylesheet" href="">
+</head>
+<body>
+  <div>
+    {{ content }}
+  </div>
+</body>
+</html>
\ No newline at end of file