@@ -8,8 +8,7 @@ discard block |
||
8 | 8 | use Illuminate\Foundation\Auth\User as Authenticatable; |
9 | 9 | use Illuminate\Support\Facades\Auth; |
10 | 10 | |
11 | -class User extends Authenticatable |
|
12 | -{ |
|
11 | +class User extends Authenticatable { |
|
13 | 12 | use Notifiable; |
14 | 13 | |
15 | 14 | /** |
@@ -47,14 +46,16 @@ discard block |
||
47 | 46 | 'updated_at' |
48 | 47 | ]; |
49 | 48 | |
50 | - public function thread() { |
|
49 | + public function thread() |
|
50 | + { |
|
51 | 51 | return $this->hasMany('App\Thread', 'user_id'); |
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @return int |
56 | 56 | */ |
57 | - public function threadAnswered() { |
|
57 | + public function threadAnswered() |
|
58 | + { |
|
58 | 59 | return count( |
59 | 60 | Thread::where('status', true) |
60 | 61 | ->where('user_id', Auth::guard('web') |
@@ -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,19 +12,23 @@ 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 doctor() { |
|
25 | + public function doctor() |
|
26 | + { |
|
25 | 27 | return $this->belongsTo('App\Doctor'); |
26 | 28 | } |
27 | 29 | |
28 | - public function trimStr(string $string) { |
|
30 | + public function trimStr(string $string) |
|
31 | + { |
|
29 | 32 | if(strlen($string) > 200) { |
30 | 33 | return substr($string, 0, 200).'...'; |
31 | 34 | } |
@@ -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,11 +73,13 @@ 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 | |
81 | - public function thread() { |
|
81 | + public function thread() |
|
82 | + { |
|
82 | 83 | return $this->hasMany('App\Thread', 'doctor_id'); |
83 | 84 | } |
84 | 85 |
@@ -7,8 +7,7 @@ |
||
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' => [ |
@@ -6,8 +6,7 @@ |
||
6 | 6 | use App\ThreadTopic; |
7 | 7 | use Illuminate\Support\Facades\Auth; |
8 | 8 | |
9 | -class ThreadController extends Controller |
|
10 | -{ |
|
9 | +class ThreadController extends Controller { |
|
11 | 10 | public function __construct() |
12 | 11 | { |
13 | 12 | $this->middleware('auth:admin', ['except' => [ |
@@ -6,8 +6,7 @@ |
||
6 | 6 | use Illuminate\Http\Request; |
7 | 7 | use Illuminate\Support\Facades\Auth; |
8 | 8 | |
9 | -class ThreadAnswerController extends Controller |
|
10 | -{ |
|
9 | +class ThreadAnswerController extends Controller { |
|
11 | 10 | public function __construct() |
12 | 11 | { |
13 | 12 | $this->middleware('auth:doctor'); |
@@ -4,8 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Log extends Model |
|
8 | -{ |
|
7 | +class Log extends Model { |
|
9 | 8 | /** |
10 | 9 | * @var string |
11 | 10 | */ |
@@ -32,35 +31,40 @@ discard block |
||
32 | 31 | /** |
33 | 32 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
34 | 33 | */ |
35 | - public function thread() { |
|
34 | + public function thread() |
|
35 | + { |
|
36 | 36 | return $this->belongsTo('App\Thread', 'thread_id'); |
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
40 | 40 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
41 | 41 | */ |
42 | - public function article() { |
|
42 | + public function article() |
|
43 | + { |
|
43 | 44 | return $this->belongsTo('App\Articles', 'article_id'); |
44 | 45 | } |
45 | 46 | |
46 | 47 | /** |
47 | 48 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
48 | 49 | */ |
49 | - public function admin() { |
|
50 | + public function admin() |
|
51 | + { |
|
50 | 52 | return $this->belongsTo('App\Admin', 'admin_id'); |
51 | 53 | } |
52 | 54 | |
53 | 55 | /** |
54 | 56 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
55 | 57 | */ |
56 | - public function doctor() { |
|
58 | + public function doctor() |
|
59 | + { |
|
57 | 60 | return $this->belongsTo('App\Doctor', 'doctor_id'); |
58 | 61 | } |
59 | 62 | |
60 | 63 | /** |
61 | 64 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
62 | 65 | */ |
63 | - public function member() { |
|
66 | + public function member() |
|
67 | + { |
|
64 | 68 | return $this->belongsTo('App\User', 'user_id'); |
65 | 69 | } |
66 | 70 | } |
@@ -8,8 +8,7 @@ discard block |
||
8 | 8 | use Illuminate\Support\Facades\Auth; |
9 | 9 | use App\Articles; |
10 | 10 | |
11 | -class ArticleController extends Controller |
|
12 | -{ |
|
11 | +class ArticleController extends Controller { |
|
13 | 12 | /** |
14 | 13 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
15 | 14 | */ |
@@ -45,13 +44,13 @@ discard block |
||
45 | 44 | 'cover_image' => 'image|nullable|max:3999' |
46 | 45 | ]); |
47 | 46 | |
48 | - if($request->hasFile('cover_image')){ |
|
47 | + if($request->hasFile('cover_image')) { |
|
49 | 48 | $filenameWithExt = $request->file('cover_image')->getClientOriginalName(); |
50 | 49 | $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME); |
51 | 50 | $extension = $request->file('cover_image')->getClientOriginalExtension(); |
52 | 51 | $fileNameToStore = $filename.'_'.time().'.'.$extension; |
53 | 52 | $path = $request->file('cover_image')->storeAs('public/cover_images', $fileNameToStore); |
54 | - }else { |
|
53 | + } else { |
|
55 | 54 | $fileNameToStore = 'noimage.jpg'; |
56 | 55 | } |
57 | 56 | |
@@ -237,7 +236,7 @@ discard block |
||
237 | 236 | |
238 | 237 | ]); |
239 | 238 | |
240 | - if($request->hasFile('cover_image')){ |
|
239 | + if($request->hasFile('cover_image')) { |
|
241 | 240 | $filenameWithExt = $request->file('cover_image')->getClientOriginalName(); |
242 | 241 | $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME); |
243 | 242 | $extension = $request->file('cover_image')->getClientOriginalExtension(); |
@@ -249,7 +248,7 @@ discard block |
||
249 | 248 | $article->category = $request->input('category'); |
250 | 249 | $article->title = $request->input('title'); |
251 | 250 | $article->content = $request->input('content'); |
252 | - if($request->hasFile('cover_image')){ |
|
251 | + if($request->hasFile('cover_image')) { |
|
253 | 252 | $article->cover_image = $fileNameToStore; |
254 | 253 | } |
255 | 254 | |
@@ -268,7 +267,7 @@ discard block |
||
268 | 267 | { |
269 | 268 | $article = Articles::find($id); |
270 | 269 | |
271 | - if($article->cover_image != 'noimage.jpg'){ |
|
270 | + if($article->cover_image != 'noimage.jpg') { |
|
272 | 271 | Storage::delete('public/cover_images/'.$article->cover_image); |
273 | 272 | } |
274 | 273 | |
@@ -284,7 +283,8 @@ discard block |
||
284 | 283 | * |
285 | 284 | * @return mixed |
286 | 285 | */ |
287 | - private function currentUser() { |
|
286 | + private function currentUser() |
|
287 | + { |
|
288 | 288 | return Auth::guard(session('guard'))->user(); |
289 | 289 | } |
290 | 290 | } |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Support\Facades\Auth; |
6 | 6 | |
7 | -class Common |
|
8 | -{ |
|
7 | +class Common { |
|
9 | 8 | |
10 | 9 | /** |
11 | 10 | * Register new activity log |