Introduce new Setting model. Set the site name.
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateSettingsTable extends Migration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('settings', function(Blueprint $table)
|
||||||
|
{
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('name');
|
||||||
|
$table->text('value')->nullable()->default(null);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('settings');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ class DatabaseSeeder extends Seeder {
|
|||||||
{
|
{
|
||||||
Eloquent::unguard();
|
Eloquent::unguard();
|
||||||
|
|
||||||
// $this->call('UserTableSeeder');
|
$this->call('SettingsTableSeeder');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
27
app/database/seeds/SettingsTableSeeder.php
Normal file
27
app/database/seeds/SettingsTableSeeder.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class SettingsTableSeeder extends Seeder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
Eloquent::unguard();
|
||||||
|
|
||||||
|
$defaultSettings = [
|
||||||
|
[
|
||||||
|
"name" => "site_name",
|
||||||
|
"value" => "Test"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Setting::truncate();
|
||||||
|
|
||||||
|
foreach($defaultSettings as $setting) {
|
||||||
|
Setting::create($setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
app/models/Setting.php
Normal file
7
app/models/Setting.php
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Setting extends Eloquent {
|
||||||
|
public static function get($settingName) {
|
||||||
|
return self::where('name', $settingName)->first()->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<div class='masthead-container'>
|
<div class='masthead-container'>
|
||||||
<div class='masthead'>
|
<div class='masthead'>
|
||||||
<div class='text-container'>
|
<div class='text-container'>
|
||||||
<span class='page-name font-largest'><a href='#'>SITE_NAME</a></span>
|
<span class='page-name font-largest'><a href='#'>{{ Setting::get('site_name') }}</a></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<title>Cachet</title>
|
<title>{{ Setting::get('site_name') }} | Cachet</title>
|
||||||
<!-- Set the viewport width to device width for mobile -->
|
<!-- Set the viewport width to device width for mobile -->
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="author" content="http://james-brooks.uk">
|
<meta name="author" content="http://james-brooks.uk">
|
||||||
|
|||||||
Reference in New Issue
Block a user