parent
b5e126e207
commit
6133ab4714
12 changed files with 508 additions and 27 deletions
@ -0,0 +1,16 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use Illuminate\Http\Request; |
||||
use App\Models\Faq; |
||||
use App\Models\Page; |
||||
|
||||
class FaqController extends Controller |
||||
{ |
||||
public function index(){ |
||||
$page = Page::where(['title' => 'FAQ','status' => 1])->first(); |
||||
$faqs = Faq::where('status',true)->get(); |
||||
return view('faq',compact('faqs','page')); |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class Faq extends Model |
||||
{ |
||||
use HasFactory; |
||||
protected $guarded = ['id']; |
||||
} |
@ -0,0 +1,36 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function up() |
||||
{ |
||||
Schema::create('faqs', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->bigInteger('service_id')->unsigned()->nullable(); |
||||
$table->foreign('service_id')->references('id')->on('services'); |
||||
$table->longText('question'); |
||||
$table->longText('answer'); |
||||
$table->enum('status',[1,2]); |
||||
$table->timestamps(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function down() |
||||
{ |
||||
Schema::dropIfExists('faqs'); |
||||
} |
||||
}; |
After Width: | Height: | Size: 717 KiB |
@ -0,0 +1,108 @@ |
||||
@extends('admin.layouts.app') |
||||
@section('content') |
||||
<!-- Content Wrapper. Contains page content --> |
||||
<div class="content-wrapper"> |
||||
<!-- Content Header (Page header) --> |
||||
<section class="content-header"> |
||||
<div class="container-fluid"> |
||||
<div class="row mb-2"> |
||||
<div class="col-sm-6"> |
||||
<h1>FAQ</h1> |
||||
</div> |
||||
</div> |
||||
</div><!-- /.container-fluid --> |
||||
</section> |
||||
|
||||
<!-- Main content --> |
||||
<section class="content"> |
||||
<div class="container-fluid"> |
||||
<!-- SELECT2 EXAMPLE --> |
||||
<div class="card card-default"> |
||||
<div class="card-header"> |
||||
<h3 class="card-title">FAQ</h3> |
||||
<a href="{{url('admin/faqs')}}" class="back-button">List</a> |
||||
</div> |
||||
<div class="card-body"> |
||||
@include('success.success') |
||||
@include('errors.error') |
||||
{!! Form::open(['url' => '/admin/faqs', 'class' => 'form-horizontal', 'method'=> 'POST','files' => true]) !!} |
||||
<div class="row"> |
||||
|
||||
|
||||
|
||||
<!-- <div class="col-md-4"> |
||||
<div class="form-group"> |
||||
<label>Service Name <span style="color: red">*</span> </label> |
||||
<select name="service_id" class="form-control" id="type" required > |
||||
<option value="" selected disabled>Please select Service Course</option> |
||||
@foreach($settings as $setting) |
||||
<option value="{{$setting->id}}" @if(old('service_id') == $setting->id) selected @endif>{{$setting->name}}</option> |
||||
@endforeach |
||||
</select> |
||||
</div> |
||||
</div> --> |
||||
|
||||
|
||||
<div class="col-md-12"> |
||||
<div class="form-group"> |
||||
<label>Question <span style="color: red">*</span> </label> |
||||
<textarea name="question" class="summernote_class">{{old('question')}} |
||||
</textarea> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-12" > |
||||
<div class="form-group" > |
||||
<label>Answer <span style="color: red">*</span> </label> |
||||
<textarea name="answer" class="summernote_class">{{old('answer')}} |
||||
</textarea> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="form-group"> |
||||
<label>Status <span style="color: red">*</span> </label> |
||||
<select name="status" class="form-control" id="type" required> |
||||
<option value="" selected disabled>Please select Status</option> |
||||
@foreach(config('custom.status') as $in => $val) |
||||
<option value="{{$in}}" @if(old('status') == $in) selected @endif>{{$val}}</option> |
||||
@endforeach |
||||
|
||||
</select> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<div class="row"> |
||||
<div class="col-md-12"> |
||||
<div id="value_section"> |
||||
|
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
<div class="form-group row create-button"> |
||||
<div class="col-sm-10 col-md-12"> |
||||
<button type="submit" class="btn btn-primary">Create</button> |
||||
</div> |
||||
</div> |
||||
{!! Form::close() !!} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</section> |
||||
</div> |
||||
@endsection |
||||
@section('script') |
||||
<script> |
||||
$(document).ready(function() { |
||||
$('.summernote_class').summernote() |
||||
|
||||
}) |
||||
|
||||
</script> |
||||
@endsection |
||||
|
@ -0,0 +1,94 @@ |
||||
@extends('admin.layouts.app') |
||||
@section('content') |
||||
<!-- Content Wrapper. Contains page content --> |
||||
<div class="content-wrapper"> |
||||
<!-- Content Header (Page header) --> |
||||
<section class="content-header"> |
||||
<div class="container-fluid"> |
||||
<div class="row mb-2"> |
||||
<div class="col-sm-6"> |
||||
<h1>FAQ</h1> |
||||
</div> |
||||
</div> |
||||
</div><!-- /.container-fluid --> |
||||
</section> |
||||
|
||||
<!-- Main content --> |
||||
<section class="content"> |
||||
<div class="container-fluid"> |
||||
<!-- SELECT2 EXAMPLE --> |
||||
<div class="card card-default"> |
||||
<div class="card-header"> |
||||
<h3 class="card-title">Edit FAQ</h3> |
||||
<a href="{{url('admin/faqs')}}" class="back-button">List</a> |
||||
</div> |
||||
<div class="card-body"> |
||||
@include('success.success') |
||||
@include('errors.error') |
||||
{!! Form::open(['url' => '/admin/faqs/'.$setting->id, 'class' => 'form-horizontal', 'method'=> 'POST','files' => true]) !!} |
||||
<div class="row"> |
||||
|
||||
|
||||
|
||||
<div class="col-md-12"> |
||||
<div class="form-group"> |
||||
<label>Question <span style="color: red">*</span> </label> |
||||
<textarea class="summernote_class" id="inputPassword3" name="question">{{$setting->question}}</textarea> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-12" > |
||||
<div class="form-group" > |
||||
<label>Answer <span style="color: red">*</span> </label> |
||||
<textarea name="answer" class="summernote_class">{{$setting->answer}} |
||||
</textarea> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="form-group"> |
||||
<label>Status <span style="color: red">*</span> </label> |
||||
<select name="status" class="form-control" id="type" required> |
||||
<option value="" selected disabled>Please select Status</option> |
||||
@foreach(config('custom.status') as $in => $val) |
||||
<option value="{{$in}}" {{($setting->status==$in) ? 'selected' : '' }}> {{$val}} </option> |
||||
@endforeach |
||||
|
||||
</select> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<div class="row"> |
||||
<div class="col-md-12"> |
||||
<div id="value_section"> |
||||
|
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
<div class="form-group row create-button"> |
||||
<div class="col-sm-10 col-md-12"> |
||||
<button type="submit" class="btn btn-primary">Update</button> |
||||
</div> |
||||
</div> |
||||
{!! Form::close() !!} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</section> |
||||
</div> |
||||
@endsection |
||||
@section('script') |
||||
<script> |
||||
$(document).ready(function() { |
||||
$('.summernote_class').summernote() |
||||
|
||||
}) |
||||
|
||||
</script> |
||||
@endsection |
||||
|
@ -0,0 +1,105 @@ |
||||
@extends('admin.layouts.app') |
||||
@section('content') |
||||
|
||||
|
||||
<div class="content-wrapper"> |
||||
<!-- Content Header (Page header) --> |
||||
<section class="content-header"> |
||||
<div class="container-fluid"> |
||||
<div class="row mb-2"> |
||||
<div class="col-sm-6"> |
||||
<h1>FAQs</h1> |
||||
</div> |
||||
</div> |
||||
</div><!-- /.container-fluid --> |
||||
</section> |
||||
|
||||
<!-- Main content --> |
||||
<section class="content"> |
||||
<div class="container-fluid"> |
||||
<div class="row"> |
||||
<div class="col-md-12"> |
||||
<div class="card"> |
||||
<div class="card-header"> |
||||
<h3 class="card-title">FAQ Table</h3> |
||||
<div class="card-tools"> |
||||
<a class="btn btn-primary" href="{{url('admin/faqs/create')}}" role="button">Create</a> |
||||
</div> |
||||
</div> |
||||
|
||||
<!-- /.card-header --> |
||||
<div class="card-body"> |
||||
@include('success.success') |
||||
@include('errors.error') |
||||
|
||||
<form id="search" class="search-form"> |
||||
<div class="row"> |
||||
<div class="input-group input-group-sm mb-3 table-search col-md-3"> |
||||
<input type="search" name="name" class="form-control ds-input" placeholder="Question / Answer" aria-label="Small" aria-describedby="inputGroup-sizing-sm" onchange="filterList()"> |
||||
</div> |
||||
|
||||
|
||||
|
||||
<div class="input-group input-group-sm mb-3 table-search col-md-3"> |
||||
<select name="status" class="form-control ds-input" onchange="filterList()"> |
||||
<option value="" disabled selected>Search By Status</option> |
||||
@foreach(config('custom.status') as $in => $val) |
||||
<option value="{{$in}}">{{$val}}</option> |
||||
@endforeach |
||||
</select> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<table class="table table-bordered"> |
||||
<thead> |
||||
<tr> |
||||
<th style="width: 10px">S.N.</th> |
||||
<th class="text-center">Question</th> |
||||
<th class="text-center">Answer</th> |
||||
<th class="text-center">Status</th> |
||||
<th class="text-center">Action</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
@foreach($settings as $setting) |
||||
<tr> |
||||
<th scope="row">{{$loop->iteration}}</th> |
||||
<td class="text-center">{{$setting->question}}</td> |
||||
<td class="text-center">{!! $setting->answer !!}</td> |
||||
<td class="text-center">{{config('custom.status')[$setting->status]}}</td> |
||||
<td class="text-center"> |
||||
<a class="btn btn-primary btn-sm" href="{{url('admin/faqs/'.$setting->id)}}"> |
||||
<i class="fas fa-folder"> |
||||
</i> |
||||
View |
||||
</a> |
||||
<a class="btn btn-info btn-sm" href="{{url('admin/faqs/'.$setting->id.'/edit')}}"> |
||||
<i class="fas fa-pencil-alt"> |
||||
</i> |
||||
Edit |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
@endforeach |
||||
|
||||
</tbody> |
||||
</table> |
||||
<div style="margin-top: 10px;"> |
||||
{!! $settings->links() !!} |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
<!-- /.card --> |
||||
|
||||
</div> |
||||
<!-- /.col --> |
||||
</div> |
||||
<!-- /.row --> |
||||
</div><!-- /.container-fluid --> |
||||
</section> |
||||
<!-- /.content --> |
||||
</div> |
||||
|
||||
@endsection |
@ -0,0 +1,86 @@ |
||||
@extends('admin.layouts.app') |
||||
@section('content') |
||||
<!-- Content Wrapper. Contains page content --> |
||||
<div class="content-wrapper"> |
||||
<!-- Content Header (Page header) --> |
||||
<section class="content-header"> |
||||
<div class="container-fluid"> |
||||
<div class="row mb-2"> |
||||
<div class="col-sm-6"> |
||||
<h1>FAQs</h1> |
||||
</div> |
||||
</div> |
||||
</div><!-- /.container-fluid --> |
||||
</section> |
||||
|
||||
<!-- Main content --> |
||||
<section class="content"> |
||||
<div class="container-fluid"> |
||||
<!-- SELECT2 EXAMPLE --> |
||||
<div class="card card-default"> |
||||
<div class="card-header"> |
||||
<h3 class="card-title">View FAQ</h3> |
||||
<a href="{{url('admin/faqs')}}" class="back-button">List</a> |
||||
</div> |
||||
<div class="card-body"> |
||||
<div class="row"> |
||||
|
||||
|
||||
|
||||
<div class="col-md-12" > |
||||
<div class="form-group" > |
||||
<label>Question <span style="color: red">*</span> </label> |
||||
<textarea name="question" class="summernote_class" rows="5" style="height: 658px;" >{{$setting->question}} |
||||
</textarea> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-12" > |
||||
<div class="form-group" > |
||||
<label>Answer <span style="color: red">*</span> </label> |
||||
<textarea name="answer" class="summernote_class" rows="5" style="height: 658px;" >{{$setting->answer}} |
||||
</textarea> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="form-group"> |
||||
<label>Status <span style="color: red">*</span> </label> |
||||
<select name="status" class="form-control" id="type" required disabled> |
||||
<option value="" selected disabled>Please select Status</option> |
||||
@foreach(config('custom.status') as $in => $val) |
||||
<option value="{{$in}}" {{($setting->status==$in) ? 'selected' : '' }}> {{$val}} </option> |
||||
@endforeach |
||||
|
||||
</select> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<div class="row"> |
||||
<div class="col-md-12"> |
||||
<div id="value_section"> |
||||
|
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</section> |
||||
</div> |
||||
@endsection |
||||
@section('script') |
||||
<script> |
||||
$(document).ready(function() { |
||||
$('.summernote_class').summernote() |
||||
|
||||
}) |
||||
|
||||
</script> |
||||
@endsection |
||||
|
Loading…
Reference in new issue