Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions app/Http/Controllers/FooterController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?php

namespace App\Http\Controllers;

use App\Models\Footer;
use Illuminate\Http\Request;

class FooterController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$footer = Footer::all();
return view('admin.footers.index', ['footers' => $footer]);
}

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*
* @param \App\Models\Footer $footer
* @return \Illuminate\Http\Response
*/
public function show(Footer $footer)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Footer $footer
* @return \Illuminate\Http\Response
*/
public function edit(Footer $footer)
{
return view('admin.footers.edit', ['footer' => $footer]);
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Footer $footer
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Footer $footer)
{
$validation = $request->validate([
'firstsection' => 'required',
'secondsection' => 'required',
'thirdsection' => 'required',
'forthsection' => 'required',
// 'featured_image' => 'required|file|image',
// 'category_id' => 'required|numeric|exists:categories,id',
// 'tags' => 'required|array|min:1|max:5',
// 'tags.*' => 'required|numeric|exists:tags,id',
]);
// $request->dd();
// // $validation['featured_image'] = $request->featured_image->store('public/images');
// $validation['content_en'] = Purify::clean($request->content_en);
$footer->update($validation);

return redirect()->route('admin.footers.index');
}

/**
* Remove the specified resource from storage.
*
* @param \App\Models\Footer $footer
* @return \Illuminate\Http\Response
*/
public function destroy(Footer $footer)
{
//
}
}
11 changes: 11 additions & 0 deletions app/Models/Footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Footer extends Model
{
use HasFactory;
}
41 changes: 41 additions & 0 deletions database/migrations/2021_11_13_155449_create_footers_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

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

class CreateFootersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('footers', function (Blueprint $table) {
$table->id();
$table->string('firstsection');
$table->string('contact');
$table->string('secondsection');
$table->string('links');
$table->string('thirdsection');
$table->string('important');
$table->string('forthsection');
$table->string('other');
$table->string('facebook');
$table->string('instagram');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('footers');
}
}
223 changes: 223 additions & 0 deletions resources/views/admin/footers/edit.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
@extends('layouts.app', ['activePage' => 'Footer Management', 'titlePage' => __('Footer Management')])

@push('css')
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/summernote.min.css" rel="stylesheet">
@endpush

@push('js')
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/summernote.min.js"></script>
<script>
$(document).ready(function() {
$('.summernote').summernote();
});
</script>
@endpush

@section('content')
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<form method="post" action="{{ route('admin.footers.update', $footer) }}" autocomplete="off"
class="form-horizontal" enctype="multipart/form-data">
@csrf
<div class="card ">
<div class="card-header card-header-primary">
<h4 class="card-title">{{ __('Footer') }}</h4>
{{-- <p class="card-category">{{ __('User information') }}</p> --}}
</div>
<div class="card-body ">
@if (session('status'))
<div class="row">
<div class="col-sm-12">
<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert"
aria-label="Close">
<i class="material-icons">close</i>
</button>
<span>{{ session('status') }}</span>
</div>
</div>
</div>
@endif
<div class="row">
<label class="col-sm-2 col-form-label">{{ __('First Section name') }}</label>
<div class="col-sm-7">
<div class="form-group{{ $errors->has('firstsection') ? ' has-danger' : '' }}">
<input class="form-control{{ $errors->has('firstsection') ? ' is-invalid' : '' }}"
name="firstsection" id="input-title-ar" type="text"
placeholder="{{ __('First Section') }}" value="{{ $footer->firstsection }}"
required="true" aria-required="true" />
@if ($errors->has('firstsection'))
<span id="firstsection-error" class="error text-danger"
for="input-firstsection">{{ $errors->first('firstsection') }}</span>
@endif
</div>
</div>
</div>

<div class="row">
<label class="col-sm-2 col-form-label">{{ __('First Section Details') }}</label>
<div class="col-sm-7">
<div class="form-group{{ $errors->has('contact') ? ' has-danger' : '' }}">
<div class="summernote">
<textarea
class="form-control{{ $errors->has('contact') ? ' is-invalid' : '' }}"
name="contact" id="input-title-ar" type="text"
placeholder="{{ __('Enter the First Section Details Here') }}"
required="true" aria-required="true" > {{ $footer->contact }} </textarea>
</div>
@if ($errors->has('contact'))
<span id="title-ar-error" class="error text-danger"
for="input-title-ar">{{ $errors->first('contact') }}</span>
@endif
</div>
</div>
</div>

<hr>

<div class="row">
<label class="col-sm-2 col-form-label">{{ __('Second Section') }}</label>
<div class="col-sm-7">
<div class="form-group{{ $errors->has('secondsection') ? ' has-danger' : '' }}">
<input
class="form-control{{ $errors->has('secondsection') ? ' is-invalid' : '' }}"
name="secondsection" id="input-title-ar" type="text"
placeholder="{{ __('Second Section') }}" value="{{ $footer->secondsection }}"
required="true" aria-required="true" />
@if ($errors->has('secondsection'))
<span id="title-ar-error" class="error text-danger"
for="input-title-ar">{{ $errors->first('secondsection') }}</span>
@endif
</div>
</div>
</div>



<div class="row">
<label class="col-sm-2 col-form-label">{{ __('Second Section Details') }}</label>
<div class="col-sm-7">
<div class="form-group{{ $errors->has('links') ? ' has-danger' : '' }}">
<div class="summernote">
<textarea
class="form-control{{ $errors->has('links') ? ' is-invalid' : '' }}"
name="links" id="input-title-ar" type="text"
placeholder="{{ __('Enter the First Section Details Here') }}"
required="true" aria-required="true" > {{ $footer->links }} </textarea>
</div>
@if ($errors->has('links'))
<span id="title-ar-error" class="error text-danger"
for="input-title-ar">{{ $errors->first('links') }}</span>
@endif
</div>
</div>
</div>

<hr>

<div class="row">
<label class="col-sm-2 col-form-label">{{ __('Third Section') }}</label>
<div class="col-sm-7">
<div class="form-group{{ $errors->has('thirdsection') ? ' has-danger' : '' }}">
<input
class="form-control{{ $errors->has('thirdsection') ? ' is-invalid' : '' }}"
name="thirdsection" id="input-title-ar" type="text"
placeholder="{{ __('Third Section') }}" value="{{ $footer->thirdsection }}"
required="true" aria-required="true" />
@if ($errors->has('thirdsection'))
<span id="title-ar-error" class="error text-danger"
for="input-title-ar">{{ $errors->first('thirdsection') }}</span>
@endif
</div>
</div>
</div>


<div class="row">
<label class="col-sm-2 col-form-label">{{ __('Third Section Details') }}</label>
<div class="col-sm-7">
<div class="form-group{{ $errors->has('important') ? ' has-danger' : '' }}">
<div class="summernote">
<textarea
class="form-control{{ $errors->has('important') ? ' is-invalid' : '' }}"
name="important" id="input-title-ar" type="text"
placeholder="{{ __('Enter the First Section Details Here') }}"
required="true" aria-required="true" > {{ $footer->important }} </textarea>
</div>
@if ($errors->has('important'))
<span id="title-ar-error" class="error text-danger"
for="input-title-ar">{{ $errors->first('important') }}</span>
@endif
</div>
</div>
</div>

<hr>


<div class="row">
<label class="col-sm-2 col-form-label">{{ __('Forth Section') }}</label>
<div class="col-sm-7">
<div class="form-group{{ $errors->has('forthsection') ? ' has-danger' : '' }}">
<input
class="form-control{{ $errors->has('forthsection') ? ' is-invalid' : '' }}"
name="forthsection" id="input-title-ar" type="text"
placeholder="{{ __('Forth Section') }}" value="{{ $footer->forthsection }}"
required="true" aria-required="true" />
@if ($errors->has('forthsection'))
<span id="title-ar-error" class="error text-danger"
for="input-title-ar">{{ $errors->first('forthsection') }}</span>
@endif
</div>
</div>
</div>


<div class="row">
<label class="col-sm-2 col-form-label">{{ __('Forth Section Details') }}</label>
<div class="col-sm-7">
<div class="form-group{{ $errors->has('other') ? ' has-danger' : '' }}">
<div class="summernote">
<textarea
class="form-control{{ $errors->has('other') ? ' is-invalid' : '' }}"
name="other" id="input-title-ar" type="text"
placeholder="{{ __('Enter the First Section Details Here') }}"
required="true" aria-required="true" > {{ $footer->other }} </textarea>
</div>
@if ($errors->has('other'))
<span id="title-ar-error" class="error text-danger"
for="input-title-ar">{{ $errors->first('other') }}</span>
@endif
</div>
</div>
</div>


{{-- <div class="row">
<label class="col-sm-2 col-form-label">{{ __('Featured Image') }}</label>
<div class="col-sm-7">
<div
class="{{ $errors->has('featured_image') ? ' has-danger' : '' }} form-file-upload form-file-simple">
<input type="file" class="form-control" name="featured_image">
@if ($errors->has('featured_image'))
<span id="title-ar-error" class="error text-danger"
for="input-title-ar">{{ $errors->first('featured_image') }}</span>
@endif
</div>
</div>
</div> --}}


</div>
<div class="card-footer ml-auto mr-auto">
<button type="submit" class="btn btn-primary">{{ __('Save') }}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection
Loading