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" => '

Deliver Remarkable Customer Experiences With a CMS-Powered Website

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.

', "fk_menu_id" => 1, "sort_order" => 1, "is_active" => 1 ], [ - "name" => "Home_Content_2", + "name" => "Home Content 2", "content" => '
', "fk_menu_id" => 1, "sort_order" => 2, "is_active" => 1 ], [ - "name" => "Home_Content_3", + "name" => "Home Content 3", "content" => '
Features Image
Features Image
Features Image

Scale your business with software you can trust.

Use our tools to explore your ideas and make your vision come true. Then share your work easily.

  • Reliability - software solutions that ensure uptime and performance,
  • Scalability - Grow your business effortlessly
  • Integration - Seamlessly integrate with existing systems
  • Support - Receive dedicated support and regular updates
', "fk_menu_id" => 1, "sort_order" => 3, "is_active" => 1 ], [ - "name" => "Home_Content_4", + "name" => "Home Content 4", "content" => '

Trusted by Open Source, enterprise, and more than 99,000 of you

Subscribe

Subscribe and start making the most of every engagement.

No spam, unsubscribe at any time

', "fk_menu_id" => 1, "sort_order" => 4,