| @@ -9,17 +9,41 @@ | ||
| 9 | 9 | use FluentCommunity\App\Models\Term; |
| 10 | 10 | use FluentCommunity\App\Models\User; |
| 11 | 11 | use FluentCommunity\App\Models\Meta; |
| 12 | 12 | |
| 13 | +/** | |
| 14 | + * @property int $id | |
| 15 | + * @property int|null $user_id | |
| 16 | + * @property string|null $title | |
| 17 | + * @property string|null $slug | |
| 18 | + * @property string|null $message | |
| 19 | + * @property string|null $message_rendered | |
| 20 | + * @property string|null $type | |
| 21 | + * @property int|null $space_id | |
| 22 | + * @property string|null $privacy | |
| 23 | + * @property string|null $status | |
| 24 | + * @property string|null $featured_image | |
| 25 | + * @property int|null $is_sticky | |
| 26 | + * @property string|null $expired_at | |
| 27 | + * @property int $comments_count | |
| 28 | + * @property int $reactions_count | |
| 29 | + * @property array $meta | |
| 30 | + * @property int|null $priority | |
| 31 | + * @property string|null $scheduled_at | |
| 32 | + * @property string|null $created_at | |
| 33 | + * @property string|null $updated_at | |
| 34 | + * @property-read Course|null $course | |
| 35 | + * @property-read mixed $lessons | |
| 36 | + */ | |
| 13 | 37 | class CourseTopic extends Model |
| 14 | 38 | { |
| 15 | 39 | protected $table = 'fcom_posts'; |
| 16 | 40 | |
| 17 | - protected $guarded = ['id']; | |
| 41 | + protected $guarded = [ 'id' ]; | |
| 18 | 42 | |
| 19 | 43 | protected $casts = [ |
| 20 | 44 | 'comments_count' => 'int', |
| 21 | - 'reactions_count' => 'int' | |
| 45 | + 'reactions_count' => 'int', | |
| 22 | 46 | ]; |
| 23 | 47 | |
| 24 | 48 | protected $fillable = [ |
| 25 | 49 | 'user_id', |
| @@ -37,18 +61,18 @@ | ||
| 37 | 61 | 'comments_count', |
| 38 | 62 | 'reactions_count', |
| 39 | 63 | 'meta', |
| 40 | 64 | 'priority', |
| 41 | - 'scheduled_at' | |
| 65 | + 'scheduled_at', | |
| 42 | 66 | ]; |
| 43 | 67 | |
| 44 | 68 | protected $searchable = [ |
| 45 | 69 | 'message', |
| 46 | - 'title' | |
| 70 | + 'title', | |
| 47 | 71 | ]; |
| 48 | 72 | |
| 49 | 73 | public static $publicColumns = [ |
| 50 | - 'id', 'slug', 'title', 'message_rendered', 'featured_image', 'created_at', 'privacy', 'type', 'status', 'slug', 'space_id', 'user_id', 'meta', 'comments_count', 'reactions_count' | |
| 74 | + 'id', 'slug', 'title', 'message_rendered', 'featured_image', 'created_at', 'privacy', 'type', 'status', 'slug', 'space_id', 'user_id', 'meta', 'comments_count', 'reactions_count', | |
| 51 | 75 | ]; |
| 52 | 76 | |
| 53 | 77 | protected static $type = 'course_section'; |
| 54 | 78 | |
| @@ -95,9 +119,9 @@ | ||
| 95 | 119 | |
| 96 | 120 | protected static function getDefaultMeta() |
| 97 | 121 | { |
| 98 | 122 | return [ |
| 99 | - 'preview_data' => null | |
| 123 | + 'preview_data' => null, | |
| 100 | 124 | ]; |
| 101 | 125 | } |
| 102 | 126 | |
| 103 | 127 | public function setMetaAttribute($value) |
| @@ -165,9 +189,9 @@ | ||
| 165 | 189 | return false; |
| 166 | 190 | } |
| 167 | 191 | |
| 168 | 192 | return (bool)Reaction::where('object_id', $this->id) |
| 169 | - ->select(['id']) | |
| 193 | + ->select([ 'id' ]) | |
| 170 | 194 | ->where('object_type', 'feed') |
| 171 | 195 | ->where('user_id', $userId) |
| 172 | 196 | ->where('type', $type) |
| 173 | 197 | ->first(); |
| @@ -187,9 +211,9 @@ | ||
| 187 | 211 | Meta::create([ |
| 188 | 212 | 'object_id' => $this->id, |
| 189 | 213 | 'object_type' => 'course_topic', |
| 190 | 214 | 'meta_key' => $key, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key |
| 191 | - 'value' => $value | |
| 215 | + 'value' => $value, | |
| 192 | 216 | ]); |
| 193 | 217 | } |
| 194 | 218 | |
| 195 | 219 | return true; |
| @@ -220,9 +244,9 @@ | ||
| 220 | 244 | } |
| 221 | 245 | // remove all tags |
| 222 | 246 | $content = wp_strip_all_tags($content); |
| 223 | 247 | // remove new lines and tabs |
| 224 | - $content = str_replace(["\r", "\n", "\t"], ' ', $content); | |
| 248 | + $content = str_replace([ "\r", "\n", "\t" ], ' ', $content); | |
| 225 | 249 | // remove multiple spaces |
| 226 | 250 | $content = preg_replace('/\s+/', ' ', $content); |
| 227 | 251 | |
| 228 | 252 | // trim |