created watchlist table
Cette révision appartient à :
Parent
55413e4e1a
révision
52d3503ddc
65
app/Http/Controllers/WatchlistController.php
Fichier normal
65
app/Http/Controllers/WatchlistController.php
Fichier normal
@ -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
11
app/Models/Watchlist.php
Fichier normal
@ -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;
|
||||
}
|
||||
37
database/migrations/2023_12_20_031354_create_watchlists_table.php
Fichier normal
37
database/migrations/2023_12_20_031354_create_watchlists_table.php
Fichier normal
@ -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');
|
||||
}
|
||||
};
|
||||
Chargement…
Référencer dans un nouveau ticket
Block a user