diff --git a/app/Models/GuestLayoutManagment.php b/app/Models/GuestLayoutManagment.php index 54e5056..678c332 100644 --- a/app/Models/GuestLayoutManagment.php +++ b/app/Models/GuestLayoutManagment.php @@ -22,22 +22,29 @@ protected static function boot() parent::boot(); static::creating(function ($model) { - self::makeComponent($model->content, $model->name); + $name = \Str::replace(' ', '_', $model->name); + self::makeComponent($model->content, $name); }); static::updating(function ($model) { - self::makeComponent($model->content, $model->name); + $name = \Str::replace(' ', '_', $model->name); + self::makeComponent($model->content, $name); }); } public static function makeComponent($component, $name) { file_put_contents( - resource_path('views/partials/elements' . $name . '.blade.php'), + resource_path('views/partials/elements/' . $name . '.blade.php'), $component ); } + public function setNameAttribute($value) + { + $this->attributes['name'] = \Str::replace(' ', '_', $value); + } + public function scopeActive() { return $this->where('is_active', true); diff --git a/database/seeders/GuestLayoutManagmentSeeder.php b/database/seeders/GuestLayoutManagmentSeeder.php index a4ccb97..9c85733 100644 --- a/database/seeders/GuestLayoutManagmentSeeder.php +++ b/database/seeders/GuestLayoutManagmentSeeder.php @@ -15,28 +15,28 @@ public function run(): void { $contents = [ [ - "name" => "Home_Content_1", + "name" => "Home Content 1", "content" => '
A CMS-powered website revolutionizes customer experiences by integrating advanced tools that streamline interactions and personalize engagements. By harnessing the capabilities of CMS systems, businesses can efficiently manage customer data, tailor content to individual preferences, automate processes, and gain actionable insights. This transformative approach not only enhances customer satisfaction and loyalty but also empowers organizations to deliver consistent, personalized experiences that set them apart in today s competitive market.
Use our tools to explore your ideas and make your vision come true. Then share your work easily.
Subscribe and start making the most of every engagement.