public function getHome()
 {
     // return view('panels.user.home');
     $user = \Auth::user();
     $kupons = \App\Kupon::all();
     return view('panels.user.home')->withUser($user)->withKupons($kupons);
 }
 public function getDashboard()
 {
     $user = \Auth::user();
     $kupons = \App\Kupon::all();
     return view('user.dashboard')->withUser($user)->withKupons($kupons);
     //
 }
 public function getHome()
 {
     // return view('panels.admin.home');
     // return view('user.dashboard');
     $user = \Auth::user();
     $pendingKupons = \App\Kupon::whereApproved(0)->get();
     $approvedKupons = \App\Kupon::whereApproved(1)->get();
     return view('panels.admin.home')->withUser($user)->withPendingKupons($pendingKupons)->withApprovedKupons($approvedKupons);
 }
 public function subscribe(Request $request)
 {
     $kuponAkanAktif = \App\Kupon::Where('kode', $request->kode)->first();
     if ($kuponAkanAktif) {
         $kuponAkanAktif->activated = true;
         $kuponAkanAktif->activated_at = \Carbon\Carbon::now();
         $kuponAkanAktif->save();
         return view('panels.user.voucher');
     } else {
         return view('panels.user.kuponsalah');
     }
 }
 public function subscribe(Request $request)
 {
     $KuponAda = \App\Kupon::Where('kode', $request->kode)->first();
     if ($KuponAda) {
         $user = \Auth::user();
         $user->subscribed = 1;
         $user->save();
         $KuponAda->delete();
         return redirect('home');
     } else {
         return 'kupon salah';
     }
 }
 public function subscribe(Request $request)
 {
     $KuponAda = \App\Kupon::Where('kode', $request->kode)->first();
     if ($KuponAda) {
         $user = \Auth::user();
         $user->subscribed = 1;
         $user->save();
         $KuponAda->delete();
         return view('panels.user.voucher');
     } else {
         return view('panels.user.kuponsalah');
     }
 }
Esempio n. 7
0
 public function getApprovedAttribute()
 {
     // Cari kupon untuk user ini
     $kupon = \App\Kupon::whereUserId($this->id)->first();
     if (!$kupon) {
         // Kupon tidak ada
         return false;
     }
     // Bandingkan aktif timestamp < 30 hari
     $approved = $kupon->approved;
     if ($approved) {
         return true;
     } else {
         return false;
     }
 }
 public function getInfodvd()
 {
     $user = \Auth::user();
     $kupons = \App\Kupon::all();
     return view('pages.infodvd')->withUser($user)->withKupons($kupons);
 }
 public function getKlasifikasimahlukhidup()
 {
     $user = \Auth::user();
     $kupons = \App\Kupon::all();
     return view('pages.biologi.bab.klasifikasimahlukhidup')->withUser($user)->withKupons($kupons);
 }
 public function getMatriks()
 {
     $user = \Auth::user();
     $kupons = \App\Kupon::all();
     return view('pages.matematikaipa.bab.matriks')->withUser($user)->withKupons($kupons);
 }
 public function getTpaTahun()
 {
     $user = \Auth::user();
     $kupons = \App\Kupon::all();
     return view('panels.user.tpatahun')->withUser($user)->withKupons($kupons);
 }
 public function getUsahadanenergi()
 {
     $user = \Auth::user();
     $kupons = \App\Kupon::all();
     return view('pages.fisika.bab.usahadanenergi')->withUser($user)->withKupons($kupons);
 }