PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 2.5.0
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v2.5.0
2.5.0 2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 All 34 releases
fluent-booking / app / Models / BookingActivity.php

BookingActivity.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 2.5.0, at app/Models/BookingActivity.php

52 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBooking\App\Models;
4
5 class BookingActivity extends Model
6 {
7 const TYPE_NOTE = 'note';
8
9 protected $table = 'fcal_booking_activity';
10
11 protected $guarded = ['id'];
12
13 protected $fillable = [
14 'booking_id',
15 'parent_id',
16 'created_by',
17 'status',
18 'type',
19 'title',
20 'description'
21 ];
22
23 public static function boot()
24 {
25 parent::boot();
26
27 static::creating(function ($model) {
28 if (!isset($model->created_by) && $userId = get_current_user_id()) {
29 $model->created_by = $userId;
30 }
31 });
32 }
33
34 public function booking()
35 {
36 return $this->belongsTo(Booking::class, 'booking_id');
37 }
38
39 /**
40 * Host notes only. System rows stay on the unscoped relation, so a note
41 * query cannot rewrite an email log or a cancellation reason.
42 *
43 * @param \FluentBooking\Framework\Database\Query\Builder $query
44 * @return \FluentBooking\Framework\Database\Query\Builder
45 */
46 public function scopeNotes($query)
47 {
48 return $query->where('type', self::TYPE_NOTE);
49 }
50
51 }
52