@@ -5,8 +5,7 @@ discard block |
||
5 | 5 | use App\Doctor; |
6 | 6 | use Illuminate\Database\Eloquent\Model; |
7 | 7 | |
8 | -class Articles extends Model |
|
9 | -{ |
|
8 | +class Articles extends Model { |
|
10 | 9 | /** |
11 | 10 | * @var string |
12 | 11 | */ |
@@ -33,7 +32,8 @@ discard block |
||
33 | 32 | /** |
34 | 33 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
35 | 34 | */ |
36 | - public function admin() { |
|
35 | + public function admin() |
|
36 | + { |
|
37 | 37 | return $this->belongsTo('App\Admin'); |
38 | 38 | } |
39 | 39 | |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
43 | 43 | */ |
44 | - public function doctor() { |
|
44 | + public function doctor() |
|
45 | + { |
|
45 | 46 | return $this->belongsTo('App\Doctor'); |
46 | 47 | } |
47 | 48 | |
@@ -49,7 +50,8 @@ discard block |
||
49 | 50 | * @param $id |
50 | 51 | * @return array |
51 | 52 | */ |
52 | - public function writer() { |
|
53 | + public function writer() |
|
54 | + { |
|
53 | 55 | $adminId = $this->getAttributeValue('admin_id'); |
54 | 56 | $doctorId = $this->getAttributeValue('doctor_id'); |
55 | 57 | |
@@ -72,7 +74,7 @@ discard block |
||
72 | 74 | */ |
73 | 75 | public function cutStr($str) |
74 | 76 | { |
75 | - if (strlen($str) > 200){ |
|
77 | + if (strlen($str) > 200) { |
|
76 | 78 | return substr($str,0,200) . "..."; |
77 | 79 | } |
78 | 80 | return $str; |
@@ -9,8 +9,7 @@ discard block |
||
9 | 9 | use Illuminate\Contracts\Auth\MustVerifyEmail; |
10 | 10 | use Illuminate\Foundation\Auth\User as Authenticatable; |
11 | 11 | |
12 | -class Doctor extends Authenticatable |
|
13 | -{ |
|
12 | +class Doctor extends Authenticatable { |
|
14 | 13 | use Notifiable; |
15 | 14 | |
16 | 15 | protected $guard = 'doctor'; |
@@ -74,7 +73,8 @@ discard block |
||
74 | 73 | return $this->belongsTo('App\DoctorSpecialization', 'specialization_id'); |
75 | 74 | } |
76 | 75 | |
77 | - public function city() { |
|
76 | + public function city() |
|
77 | + { |
|
78 | 78 | return $this->belongsTo('App\City', 'city_id'); |
79 | 79 | } |
80 | 80 |
@@ -7,8 +7,7 @@ discard block |
||
7 | 7 | use Carbon\Carbon; |
8 | 8 | use Illuminate\Foundation\Auth\User as Authenticatable; |
9 | 9 | |
10 | -class User extends Authenticatable |
|
11 | -{ |
|
10 | +class User extends Authenticatable { |
|
12 | 11 | use Notifiable; |
13 | 12 | |
14 | 13 | /** |
@@ -46,7 +45,8 @@ discard block |
||
46 | 45 | 'updated_at' |
47 | 46 | ]; |
48 | 47 | |
49 | - public function thread() { |
|
48 | + public function thread() |
|
49 | + { |
|
50 | 50 | return $this->hasMany('App\Thread', 'user_id'); |
51 | 51 | } |
52 | 52 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | public function trimStr(string $string) { |
25 | - if(strlen($string) > 200) { |
|
25 | + if (strlen($string) > 200) { |
|
26 | 26 | return substr($string, 0, 200).'...'; |
27 | 27 | } |
28 | 28 | } |
@@ -4,8 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Thread extends Model |
|
8 | -{ |
|
7 | +class Thread extends Model { |
|
9 | 8 | protected $table = 'threads'; |
10 | 9 | |
11 | 10 | protected $dates = [ |
@@ -13,15 +12,18 @@ discard block |
||
13 | 12 | 'updated_at' |
14 | 13 | ]; |
15 | 14 | |
16 | - public function topic() { |
|
15 | + public function topic() |
|
16 | + { |
|
17 | 17 | return $this->belongsTo('App\ThreadTopic', 'id_topic'); |
18 | 18 | } |
19 | 19 | |
20 | - public function user() { |
|
20 | + public function user() |
|
21 | + { |
|
21 | 22 | return $this->belongsTo('App\User'); |
22 | 23 | } |
23 | 24 | |
24 | - public function trimStr(string $string) { |
|
25 | + public function trimStr(string $string) |
|
26 | + { |
|
25 | 27 | if(strlen($string) > 200) { |
26 | 28 | return substr($string, 0, 200).'...'; |
27 | 29 | } |
@@ -4,8 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class City extends Model |
|
8 | -{ |
|
7 | +class City extends Model { |
|
9 | 8 | /** |
10 | 9 | * @var string |
11 | 10 | */ |
@@ -37,7 +36,8 @@ discard block |
||
37 | 36 | return $this->hasMany('App\Hospital'); |
38 | 37 | } |
39 | 38 | |
40 | - public function doctor() { |
|
39 | + public function doctor() |
|
40 | + { |
|
41 | 41 | return $this->belongsTo('App\Doctor'); |
42 | 42 | } |
43 | 43 | } |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class ThreadTopic extends Model |
|
8 | -{ |
|
7 | +class ThreadTopic extends Model { |
|
9 | 8 | protected $table = 'thread_topics'; |
10 | 9 | |
11 | 10 | protected $dates = [ |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $user = null; |
33 | 33 | $err = null; |
34 | 34 | |
35 | - if($provider == 'google') { |
|
35 | + if ($provider == 'google') { |
|
36 | 36 | $user = Socialite::driver($provider)->stateless()->user(); |
37 | 37 | } else { |
38 | 38 | $user = Socialite::driver($provider)->user(); |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | |
41 | 41 | $authUser = $this->findOrCreateUser($user, $provider); |
42 | 42 | |
43 | - $attempt = Auth::guard('web')->attempt(['email' => $authUser->email, 'password' => $authUser->provider_id]); |
|
43 | + $attempt = Auth::guard('web')->attempt([ 'email' => $authUser->email, 'password' => $authUser->provider_id ]); |
|
44 | 44 | |
45 | 45 | $req = new Request([ |
46 | 46 | 'email' => $authUser->email, |
47 | 47 | ]); |
48 | 48 | |
49 | - if($attempt) { |
|
49 | + if ($attempt) { |
|
50 | 50 | $msg = "Selamat Datang ".$authUser->name." !"; |
51 | 51 | return redirect()->intended(route('home'))->with('info', $msg); |
52 | 52 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | private function findOrCreateUser($user, $provider) |
66 | 66 | { |
67 | 67 | $authUser = User::where('email', $user->getEmail())->first(); |
68 | - if($authUser) { |
|
68 | + if ($authUser) { |
|
69 | 69 | return $authUser; |
70 | 70 | } |
71 | 71 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | private function sendFailedLoginResponse(Request $request) |
85 | 85 | { |
86 | 86 | throw ValidationException::withMessages([ |
87 | - 'email' => [trans('auth.failed')], |
|
87 | + 'email' => [ trans('auth.failed') ], |
|
88 | 88 | ]); |
89 | 89 | |
90 | 90 | } |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | 6 | |
7 | -class ThreadAnswerController extends Controller |
|
8 | -{ |
|
7 | +class ThreadAnswerController extends Controller { |
|
9 | 8 | /** |
10 | 9 | * Display a listing of the resource. |
11 | 10 | * |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | { |
12 | 12 | public function __construct() |
13 | 13 | { |
14 | - $this->middleware('auth', ['except' => [ |
|
14 | + $this->middleware('auth', [ 'except' => [ |
|
15 | 15 | 'index', 'show' |
16 | - ]]); |
|
16 | + ] ]); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function create() |
37 | 37 | { |
38 | 38 | $threads = Thread::orderBy('created_at', 'asc')->get(); |
39 | - return view('ask-form')->with('threads', $threads);; |
|
39 | + return view('ask-form')->with('threads', $threads); ; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | |
56 | 56 | $topic = $this->addTopic($request->input('topic')); |
57 | 57 | |
58 | - if($topic != null) { |
|
58 | + if ($topic != null) { |
|
59 | 59 | $thread = new Thread; |
60 | 60 | $thread->user_id = $this->currentUser()->id; |
61 | 61 | $thread->id_topic = $topic->id; |
62 | 62 | $thread->question = $request->input('question'); |
63 | 63 | |
64 | - if($thread->save()) { |
|
64 | + if ($thread->save()) { |
|
65 | 65 | return redirect(route('user.thread.index'))->with('success', 'Pertanyaan dikirim !'); |
66 | 66 | } |
67 | 67 | return redirect()->back()->with('failed', 'Gagal mengirim pertanyaan, silahkan coba lagi nanti.'); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | private function addTopic(string $topic) { |
127 | 127 | $new = new ThreadTopic; |
128 | 128 | $new->topic_name = $topic; |
129 | - if($new->save()) { |
|
129 | + if ($new->save()) { |
|
130 | 130 | return $new; |
131 | 131 | } |
132 | 132 | return null; |
@@ -7,8 +7,7 @@ discard block |
||
7 | 7 | use App\Thread; |
8 | 8 | use App\ThreadTopic; |
9 | 9 | |
10 | -class ThreadAskController extends Controller |
|
11 | -{ |
|
10 | +class ThreadAskController extends Controller { |
|
12 | 11 | public function __construct() |
13 | 12 | { |
14 | 13 | $this->middleware('auth', ['except' => [ |
@@ -115,7 +114,8 @@ discard block |
||
115 | 114 | } |
116 | 115 | |
117 | 116 | |
118 | - private function currentUser() { |
|
117 | + private function currentUser() |
|
118 | + { |
|
119 | 119 | return Auth::guard('web')->user(); |
120 | 120 | } |
121 | 121 | |
@@ -123,7 +123,8 @@ discard block |
||
123 | 123 | * @param string $topic |
124 | 124 | * @return ThreadTopic|null |
125 | 125 | */ |
126 | - private function addTopic(string $topic) { |
|
126 | + private function addTopic(string $topic) |
|
127 | + { |
|
127 | 128 | $new = new ThreadTopic; |
128 | 129 | $new->topic_name = $topic; |
129 | 130 | if($new->save()) { |