@@ -14,25 +14,25 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class VisitServiceProvider extends ServiceProvider |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * Bootstrap the application services. |
|
| 19 | - * |
|
| 20 | - * @return void |
|
| 21 | - */ |
|
| 22 | - public function boot() |
|
| 23 | - { |
|
| 24 | - $this->publishes([ |
|
| 25 | - __DIR__.'/../migrations/create_visits_table.php.stub' => database_path('migrations/'.date('Y_m_d_His').'_create_visits_table.php'), |
|
| 17 | + /** |
|
| 18 | + * Bootstrap the application services. |
|
| 19 | + * |
|
| 20 | + * @return void |
|
| 21 | + */ |
|
| 22 | + public function boot() |
|
| 23 | + { |
|
| 24 | + $this->publishes([ |
|
| 25 | + __DIR__.'/../migrations/create_visits_table.php.stub' => database_path('migrations/'.date('Y_m_d_His').'_create_visits_table.php'), |
|
| 26 | 26 | ], 'migrations'); |
| 27 | - } |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Register the application services. |
|
| 31 | - * |
|
| 32 | - * @return void |
|
| 33 | - */ |
|
| 34 | - public function register() |
|
| 35 | - { |
|
| 36 | - # code... |
|
| 37 | - } |
|
| 29 | + /** |
|
| 30 | + * Register the application services. |
|
| 31 | + * |
|
| 32 | + * @return void |
|
| 33 | + */ |
|
| 34 | + public function register() |
|
| 35 | + { |
|
| 36 | + # code... |
|
| 37 | + } |
|
| 38 | 38 | } |
| 39 | 39 | \ No newline at end of file |
@@ -16,31 +16,31 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Visit extends Model |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | + /** |
|
| 20 | 20 | * The table associated with the model. |
| 21 | 21 | * |
| 22 | 22 | * @var string |
| 23 | 23 | */ |
| 24 | - protected $table = 'visits'; |
|
| 24 | + protected $table = 'visits'; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | + /** |
|
| 27 | 27 | * The attributes that are mass assignable. |
| 28 | 28 | * |
| 29 | 29 | * @var array |
| 30 | 30 | */ |
| 31 | - protected $fillable = ['user_id']; |
|
| 31 | + protected $fillable = ['user_id']; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | + /** |
|
| 34 | 34 | * Define a polymorphic, inverse one-to-one or many relationship. |
| 35 | 35 | * |
| 36 | 36 | * @return MorphTo |
| 37 | 37 | */ |
| 38 | - public function visitable() |
|
| 39 | - { |
|
| 40 | - return $this->morphTo(); |
|
| 41 | - } |
|
| 38 | + public function visitable() |
|
| 39 | + { |
|
| 40 | + return $this->morphTo(); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function user() |
|
| 43 | + public function user() |
|
| 44 | 44 | { |
| 45 | 45 | return $this->belongsTo(Config::get('auth.providers.users.model')); |
| 46 | 46 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $user = $this->visits()->with('user')->get(); |
| 116 | 116 | |
| 117 | - return $user->mapWithKeys(function ($item) { |
|
| 117 | + return $user->mapWithKeys(function($item) { |
|
| 118 | 118 | return [$item['user']->id => $item['user']]; |
| 119 | 119 | }); |
| 120 | 120 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public static function bootVisitable() |
| 146 | 146 | { |
| 147 | 147 | static::deleted( |
| 148 | - function ($model) { |
|
| 148 | + function($model) { |
|
| 149 | 149 | $model->visits()->delete(); |
| 150 | 150 | } |
| 151 | 151 | ); |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | public function visits($class) |
| 38 | 38 | { |
| 39 | - return $this->visitss()->where('visitsable_type', $class)->with('visitsable')->get()->mapWithKeys(function ($item) { |
|
| 39 | + return $this->visitss()->where('visitsable_type', $class)->with('visitsable')->get()->mapWithKeys(function($item) { |
|
| 40 | 40 | if (isset($item['visitsable'])) { |
| 41 | 41 | return [$item['visitsable']->id=>$item['visitsable']]; |
| 42 | 42 | } |