created watchlist table

Cette révision appartient à :
Ibrahim Khail Shakil 2023-12-20 09:23:44 +06:00
Parent 55413e4e1a
révision 52d3503ddc
4 fichiers modifiés avec 114 ajouts et 1 suppressions

Voir le fichier

@ -0,0 +1,65 @@
<?php
namespace App\Http\Controllers;
use App\Models\Watchlist;
use Illuminate\Http\Request;
class WatchlistController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(Watchlist $watchlist)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Watchlist $watchlist)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Watchlist $watchlist)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Watchlist $watchlist)
{
//
}
}

11
app/Models/Watchlist.php Fichier normal
Voir le fichier

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Watchlist extends Model
{
use HasFactory;
}

Voir le fichier

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('watchlists', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('student_id')->index();
$table->unsignedBigInteger('course_id')->index();
$table->unsignedBigInteger('lesson_id')->index();
$table->unsignedBigInteger('material_id')->index();
$table->timestamps();
$table->softDeletes();
$table->foreign('student_id')->references('id')->on('students')->onDelete('cascade');
$table->foreign('course_id')->references('id')->on('courses')->onDelete('cascade');
$table->foreign('lesson_id')->references('id')->on('lessons')->onDelete('cascade');
$table->foreign('material_id')->references('id')->on('materials')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('watchlists');
}
};