<?php
return [
'app' => [
'title' => 'General',
'icon' => 'fas fa-cube',
'desc' => 'All the general settings for application.',
'elements' => [
[
'type' => 'text', // input fields type
'name' => 'app_name', // unique name for field
'label' => 'App Name', // you know what label it is
'class' => '', // any class for input
'rules' => 'required|min:2|max:50', // validation rule of laravel
'value' => 'Laravel Starter' // default value if you want
],
[
'type' => 'text', // input fields type
'name' => 'footer_text', // unique name for field
'label' => 'Footer Text', // you know what label it is
'class' => '', // any class for input
'rules' => 'required|min:2', // validation rule of laravel
'value' => '<a href="#" class="text-muted">Built with ♥ from Bangladesh</a>' // default value if you want
],
]
],
];
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->string('val')->nullable();
$table->char('type', 10)->default('string');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('settings');
}
};
Chú ý: Nếu cho config dạng mảng như này nó sẽ gộp các phần từ lại với nhau
<?php
return [
'app' => [
'title' => 'General',
'icon' => 'fas fa-cube',
'desc' => 'All the general settings for application.',
'elements' => [
[
'type' => 'text', // input fields type
'name' => 'app_name', // unique name for field
'label' => 'App Name', // you know what label it is
'class' => '', // any class for input
'rules' => 'required|min:2|max:50', // validation rule of laravel
'value' => 'Laravel Starter' // default value if you want
],
[
'type' => 'text', // input fields type
'name' => 'footer_text', // unique name for field
'label' => 'Footer Text', // you know what label it is
'class' => '', // any class for input
'rules' => 'required|min:2', // validation rule of laravel
'value' => '<a href="#" class="text-muted">Built with ♥ from Bangladesh</a>' // default value if you want
],
]
],
'test' => [
'title' => 'General',
'icon' => 'fas fa-cube',
'desc' => 'All the general settings for application.',
'elements' => [
[
'type' => 'text', // input fields type
'name' => 'app_name', // unique name for field
'label' => 'App Name', // you know what label it is
'class' => '', // any class for input
'rules' => 'required|min:2|max:50', // validation rule of laravel
'value' => 'Laravel Starter' // default value if you want
],
[
'type' => 'text', // input fields type
'name' => 'footer_text', // unique name for field
'label' => 'Footer Text', // you know what label it is
'class' => '', // any class for input
'rules' => 'required|min:2', // validation rule of laravel
'value' => '<a href="#" class="text-muted">Built with ♥ from Bangladesh</a>' // default value if you want
],
]
],
];