Skip to content

Commit

Permalink
Faqs Table in db with controller and models file
Browse files Browse the repository at this point in the history
  • Loading branch information
meowfu0 committed Oct 4, 2024
1 parent 5924abc commit 1af892e
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 0 deletions.
85 changes: 85 additions & 0 deletions app/Http/Controllers/FaqController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

namespace App\Http\Controllers;

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

class FaqController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}

/**
* 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\Faq $faq
* @return \Illuminate\Http\Response
*/
public function show(Faq $faq)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Faq $faq
* @return \Illuminate\Http\Response
*/
public function edit(Faq $faq)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Faq $faq
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Faq $faq)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param \App\Models\Faq $faq
* @return \Illuminate\Http\Response
*/
public function destroy(Faq $faq)
{
//
}
}
11 changes: 11 additions & 0 deletions app/Models/Faq.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 Faq extends Model
{
use HasFactory;
}
38 changes: 38 additions & 0 deletions database/migrations/2024_10_04_200751_create_faqs_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

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

class CreateFaqsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('faqs', function (Blueprint $table) {
$table->id();
$table->text('questions');
$table->text('answers');
$table->timestamp('created_at')->useCurrent();
$table->timestamp('modified_at')->nullable()->useCurrentOnUpdate();
$table->timestamp('deleted_at')->nullable();

$table->unsignedBigInteger('status_id');
$table->foreign('status_id')->references('id')->on('statuses')->onDelete('cascade');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('faqs');
}
}

0 comments on commit 1af892e

Please sign in to comment.