/
var
/
www
/
html
/
gnet
/
app
/
Models
/
Upload File
HOME
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; class Article extends Model { use HasFactory; protected $table = 'artikel'; protected $fillable = [ 'title', 'url', 'author', 'date', 'banner_image', 'banner_image_low', 'banner_image_mobile', 'banner_image_mobile_low', 'alt_text', 'content', 'keywords', ]; const CREATED_AT = 'created_at'; const UPDATED_AT = 'updated_at'; public function generateTableOfContent() { $pattern = '/<h[1-6]>(.*?)<\/h[1-6]>/'; preg_match_all($pattern, $this->content, $matches); $toc = []; foreach ($matches[1] as $match) { $toc[] = $match; } return $toc; } }