Skip to content

Commit

Permalink
SEO Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Loydtafireyi committed Sep 9, 2020
1 parent 8ce5b26 commit 2b13884
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 4 deletions.
3 changes: 3 additions & 0 deletions app/Http/Controllers/Admin/SystemSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ public function update(Request $request, $slug)
'address',
'description',
'meta_keywords',
'facebook_pixel',
'meta_description',
'google_analytics',

]);

if($request->hasFile('logo')) {
Expand Down
2 changes: 1 addition & 1 deletion app/SystemSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class SystemSetting extends Model
{
protected $fillable = ['name', 'description', 'email', 'tel', 'address', 'logo', 'favicon', 'meta_keywords', 'meta_description'];
protected $fillable = ['name', 'description', 'email', 'tel', 'address', 'logo', 'favicon', 'meta_keywords', 'meta_description', 'google_analytics', 'facebook_pixel'];

public function getRouteKeyName()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddAnalyticsToSystemSetttingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('system_settings', function (Blueprint $table) {
$table->string('google_analytics')->nullable();
$table->string('facebook_pixel')->nullable();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('system_settings', function (Blueprint $table) {
$table->dropColumn('google_analytics');
$table->dropColumn('facebook_pixel');
});
}
}
10 changes: 9 additions & 1 deletion resources/views/admin/settings/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@
</div>
<div class="form-group">
<label for="meta_keywords">System Meta Keywords</label>
<textarea name="meta_keywords" class="form-control" placeholder="Seperate keywords using comma...">{{ $setting->meta_keywords }}</textarea>
<input name="meta_keywords" class="form-control" placeholder="Seperate keywords using comma..." value="{{ $setting->meta_keywords }}">
</div>
<div class="form-group">
<label for="facebook_pixel">Facebook Pixel</label>
<input name="facebook_pixel" class="form-control" placeholder="Your Facebook Pixel ID eg AC-162735780-5" value="{{ $setting->facebook_pixel }}">
</div>
<div class="form-group">
<label for="google_analytics">Google Analytics</label>
<input name="google_analytics" class="form-control" placeholder="Your Google Analytics ID eg AC-162735780-5" value="{{ $setting->google_analytics }}">
</div>
<!-- system seo start -->

Expand Down
4 changes: 2 additions & 2 deletions resources/views/checkout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
</div>
<div class="row address-inputs">
<div class="col-md-6">
<input type="text" name="billing_fullname" placeholder="Full Name">
<input type="text" name="billing_fullname" placeholder="Full Name" value="{{ auth()->user()->name }}">
</div>
<div class="col-md-6">
<input type="text" name="billing_email" placeholder="Email">
<input type="text" name="billing_email" placeholder="Email" value="{{ auth()->user()->email }}">
</div>
<div class="col-md-12">
<input type="text" name="billing_address" placeholder="Address">
Expand Down
12 changes: 12 additions & 0 deletions resources/views/layouts/frontend.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@

<livewire:styles />

<!-- Global site tag (gtag.js) - Google Analytics -->
@if($shareSettings->google_analytics != null)
<script async src="https://www.googletagmanager.com/gtag/js?id={{ $shareSettings->google_analytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ $shareSettings->google_analytics }}');
</script>
@endif


<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
Expand Down

0 comments on commit 2b13884

Please sign in to comment.