From ad48a6a556b8a3581a1f5377acbe1fc7c980ede0 Mon Sep 17 00:00:00 2001 From: Fadhil Yori Hibatullah Date: Tue, 12 Feb 2019 19:49:19 +0700 Subject: [PATCH] Menambahkan halaman untuk admin dan banyak perbaikan bug #2 --- app/Http/Controllers/AdminController.php | 97 ++++++++++ .../github/GitHub-Mark-32px_compressed.png | Bin 0 -> 881 bytes resources/views/auth/login.blade.php | 173 +++++++++++++++++ .../views/auth/passwords/email.blade.php | 47 +++++ .../views/auth/passwords/reset.blade.php | 65 +++++++ resources/views/auth/register.blade.php | 181 ++++++++++++++++++ resources/views/layouts/app.blade.php | 81 ++++++++ 7 files changed, 644 insertions(+) create mode 100644 app/Http/Controllers/AdminController.php create mode 100644 public/img/github/GitHub-Mark-32px_compressed.png create mode 100644 resources/views/auth/login.blade.php create mode 100644 resources/views/auth/passwords/email.blade.php create mode 100644 resources/views/auth/passwords/reset.blade.php create mode 100644 resources/views/auth/register.blade.php create mode 100644 resources/views/layouts/app.blade.php diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php new file mode 100644 index 0000000..d0e6314 --- /dev/null +++ b/app/Http/Controllers/AdminController.php @@ -0,0 +1,97 @@ +middleware('auth'); + } + + /** + * Show the application dashboard. + * + * @return \Illuminate\Http\Response + */ + public function index() + { + return view('pages/admin-dashboard'); + } + + public function shorturl() + { + $data = []; + $i = 1; + $short_urls = ShortUrl::with('custom_url')->get(); + $short_urls->map(function ($short_url) { + return $short_url->custom_url; + }); + foreach ($short_urls as $item) { + $obj = new \stdClass(); + $obj->no = $i++; + $obj->id = $item->id; + $obj->url = Crypt::decryptString($item->url); + $obj->shorturl = Crypt::decryptString($item->shorturl); + $obj->created_at = date("j F Y", strtotime($item->created_at)); + array_push($data, $obj); + } + + return view('pages/admin-shorturl', ['data' => $data]); + } + + public function customurl() + { + $data = array(); + $i = 1; + $short_urls = ShortUrl::with('custom_url')->get(); + $short_urls->map(function ($short_url) { + return $short_url->custom_url; + }); + foreach ($short_urls as $item) { + foreach ($item->custom_url as $cus_item) { + $obj = new \stdClass(); + $obj->no = $i++; + $obj->id = $cus_item->id; + $obj->url = Crypt::decryptString($item->url); + $obj->customurl = Crypt::decryptString($cus_item->customurl); + $obj->created_at = date("j F Y", strtotime($cus_item->created_at)); + array_push($data, $obj); + } + } + return view('pages/admin-customurl', ['data' => $data]); + } + + public function delete_shorturl($id) { + if (Auth::check()) { + try { + $del = ShortUrl::query()->find($id)->delete(); + } catch (\Exception $e) { + return $e->getMessage(); + } + } + return redirect(route('admin.shorturl')); + } + + public function delete_customurl($id) { + if (Auth::check()) { + try { + $del = CustomUrl::query()->find($id)->delete(); + } catch (\Exception $e) { + return $e->getMessage(); + } + } + return redirect(route('admin.customurl')); + } +} diff --git a/public/img/github/GitHub-Mark-32px_compressed.png b/public/img/github/GitHub-Mark-32px_compressed.png new file mode 100644 index 0000000000000000000000000000000000000000..84c7055c880935fffb8e8479a714771dde7d73c9 GIT binary patch literal 881 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabRA=0VAKil32_B-|Ns9lE-E&P2!=rI zb4Dv*cqNwv`2_>RkBOOuor8y$UqDbuL{v;dQchk`!_dgs#MHvl#?Ic!Eixu9J|QVN zB{e-Gzqq8dqN=W|fBNjX^Ome!wR-Kk4cm7fJaqWT$qN@RUAuMr&b|8&A3c8Y>h+tC zpFV&6_WjrIKmYRMs#Sp2O!Rbd46*2Ko%Ay7kbyw!aV61HN}?<*<%}yI^))nfX>+B9 zPH`1H`Fnr!$tBnH<~;tBu1>e7a zxx&`9g(bMV=XinVlwP4SgM)%;%r1d_7gsff-l@_noTAO}$vjMRwPNe1?L3k?akXL1 z?^zw$PR+RdZL`0!MswF(mEDeq{)auBymZ}M<`T)DEIC)^q-H2SYI~@2c!G2V*NsYt z=wCgSndT~jHiucC&ANPQt|^Q7hQsUi(@mf3*vI^iKQ8v9+n$o6SNY8y=1ur~mfdNe z-uL9sH)`H4__TCyx6NO^zLQ@(Y7Xrdp5eIT;{CH0Ct7sYhE2bDcg^R2(z_H-e~(su z!e?{p<~JL2oqwNJna%d$|9WAAbN{jEU;CVWo#gz>{Kb9R(q82Ez86#NzgUo6<$UPg x?3*9<=|}jTE4}ifdymNP-sI_g&;E7F$GloyaIf(B9bj5u@O1TaS?83{1OV4-DChtH literal 0 HcmV?d00001 diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php new file mode 100644 index 0000000..45d66ae --- /dev/null +++ b/resources/views/auth/login.blade.php @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + URL Shortener by KLAS + + + + + + + + +
+
+
+
+
+
+
{{ __('Login') }}
+
+ +
+ @csrf + +
+
+
+
+ +
+ + +
+ +
+ + +
+ +
+

+ +

+
+ +
+ + Lupa password ?
Reset Password
+
+
+
+
+
+ +
+
+
+ @csrf + +
+
+
+
+ +
+ + +
+ +
+ + +
+ +
+

+ +

+
+ +
+ + Lupa password ?
Reset Password
+
+
+
+
+
+ +
+ +
+ + + + + diff --git a/resources/views/auth/passwords/email.blade.php b/resources/views/auth/passwords/email.blade.php new file mode 100644 index 0000000..12e8083 --- /dev/null +++ b/resources/views/auth/passwords/email.blade.php @@ -0,0 +1,47 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
{{ __('Reset Password') }}
+ +
+ @if (session('status')) + + @endif + +
+ @csrf + +
+ + +
+ + + @if ($errors->has('email')) + + {{ $errors->first('email') }} + + @endif +
+
+ +
+
+ +
+
+
+
+
+
+
+
+@endsection diff --git a/resources/views/auth/passwords/reset.blade.php b/resources/views/auth/passwords/reset.blade.php new file mode 100644 index 0000000..3557662 --- /dev/null +++ b/resources/views/auth/passwords/reset.blade.php @@ -0,0 +1,65 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
{{ __('Reset Password') }}
+ +
+
+ @csrf + + + +
+ + +
+ + + @if ($errors->has('email')) + + {{ $errors->first('email') }} + + @endif +
+
+ +
+ + +
+ + + @if ($errors->has('password')) + + {{ $errors->first('password') }} + + @endif +
+
+ +
+ + +
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+@endsection diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php new file mode 100644 index 0000000..47713c3 --- /dev/null +++ b/resources/views/auth/register.blade.php @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + URL Shortener by KLAS + + + + + + + + +
+
+
+
+
+
+
{{ __('Register') }}
+
+ +
+ @csrf + +
+
+
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +
+ Sudah punya akun ? Masuk disini +
+
+
+
+
+ +
+
+
+ @csrf + +
+
+
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +
+ Sudah punya akun ? Masuk disini +
+
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php new file mode 100644 index 0000000..f4d0885 --- /dev/null +++ b/resources/views/layouts/app.blade.php @@ -0,0 +1,81 @@ + + + + + + + + + + + + URL Shortener by KLAS + + + + + + + + + + + + @yield('jsscript') + + +
+ + + +
+
+ @yield('content') +
+ + + +