creation of Notifications table and migration

This commit is contained in:
2025-11-09 18:04:25 +01:00
parent 8341021ba5
commit 3c2128b9b7
5 changed files with 86 additions and 36 deletions
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
protected $fillable = [
'content',
];
public function users(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(User::class, 'user_notification', 'notification_id', 'user_id');
}
}
+5
View File
@@ -50,4 +50,9 @@ class User extends Authenticatable
'password' => 'hashed', 'password' => 'hashed',
]; ];
} }
public function notifications(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(Notification::class, 'user_notification', 'user_id', 'notification_id');
}
} }
Generated
+35 -35
View File
@@ -1055,16 +1055,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v12.33.0", "version": "v12.34.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "124efc5f09d4668a4dc13f94a1018c524a58bcb1" "reference": "f9ec5a5d88bc8c468f17b59f88e05c8ac3c8d687"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/124efc5f09d4668a4dc13f94a1018c524a58bcb1", "url": "https://api.github.com/repos/laravel/framework/zipball/f9ec5a5d88bc8c468f17b59f88e05c8ac3c8d687",
"reference": "124efc5f09d4668a4dc13f94a1018c524a58bcb1", "reference": "f9ec5a5d88bc8c468f17b59f88e05c8ac3c8d687",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1176,7 +1176,7 @@
"league/flysystem-sftp-v3": "^3.25.1", "league/flysystem-sftp-v3": "^3.25.1",
"mockery/mockery": "^1.6.10", "mockery/mockery": "^1.6.10",
"opis/json-schema": "^2.4.1", "opis/json-schema": "^2.4.1",
"orchestra/testbench-core": "^10.6.5", "orchestra/testbench-core": "^10.7.0",
"pda/pheanstalk": "^5.0.6|^7.0.0", "pda/pheanstalk": "^5.0.6|^7.0.0",
"php-http/discovery": "^1.15", "php-http/discovery": "^1.15",
"phpstan/phpstan": "^2.0", "phpstan/phpstan": "^2.0",
@@ -1270,7 +1270,7 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2025-10-07T14:30:39+00:00" "time": "2025-10-14T13:58:31+00:00"
}, },
{ {
"name": "laravel/prompts", "name": "laravel/prompts",
@@ -1397,16 +1397,16 @@
}, },
{ {
"name": "laravel/serializable-closure", "name": "laravel/serializable-closure",
"version": "v2.0.5", "version": "v2.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/serializable-closure.git", "url": "https://github.com/laravel/serializable-closure.git",
"reference": "3832547db6e0e2f8bb03d4093857b378c66eceed" "reference": "038ce42edee619599a1debb7e81d7b3759492819"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/3832547db6e0e2f8bb03d4093857b378c66eceed", "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/038ce42edee619599a1debb7e81d7b3759492819",
"reference": "3832547db6e0e2f8bb03d4093857b378c66eceed", "reference": "038ce42edee619599a1debb7e81d7b3759492819",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1454,7 +1454,7 @@
"issues": "https://github.com/laravel/serializable-closure/issues", "issues": "https://github.com/laravel/serializable-closure/issues",
"source": "https://github.com/laravel/serializable-closure" "source": "https://github.com/laravel/serializable-closure"
}, },
"time": "2025-09-22T17:29:40+00:00" "time": "2025-10-09T13:42:30+00:00"
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
@@ -2492,31 +2492,31 @@
}, },
{ {
"name": "nunomaduro/termwind", "name": "nunomaduro/termwind",
"version": "v2.3.1", "version": "v2.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nunomaduro/termwind.git", "url": "https://github.com/nunomaduro/termwind.git",
"reference": "dfa08f390e509967a15c22493dc0bac5733d9123" "reference": "eb61920a53057a7debd718a5b89c2178032b52c0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nunomaduro/termwind/zipball/dfa08f390e509967a15c22493dc0bac5733d9123", "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/eb61920a53057a7debd718a5b89c2178032b52c0",
"reference": "dfa08f390e509967a15c22493dc0bac5733d9123", "reference": "eb61920a53057a7debd718a5b89c2178032b52c0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-mbstring": "*", "ext-mbstring": "*",
"php": "^8.2", "php": "^8.2",
"symfony/console": "^7.2.6" "symfony/console": "^7.3.4"
}, },
"require-dev": { "require-dev": {
"illuminate/console": "^11.44.7", "illuminate/console": "^11.46.1",
"laravel/pint": "^1.22.0", "laravel/pint": "^1.25.1",
"mockery/mockery": "^1.6.12", "mockery/mockery": "^1.6.12",
"pestphp/pest": "^2.36.0 || ^3.8.2", "pestphp/pest": "^2.36.0 || ^3.8.4",
"phpstan/phpstan": "^1.12.25", "phpstan/phpstan": "^1.12.32",
"phpstan/phpstan-strict-rules": "^1.6.2", "phpstan/phpstan-strict-rules": "^1.6.2",
"symfony/var-dumper": "^7.2.6", "symfony/var-dumper": "^7.3.4",
"thecodingmachine/phpstan-strict-rules": "^1.0.0" "thecodingmachine/phpstan-strict-rules": "^1.0.0"
}, },
"type": "library", "type": "library",
@@ -2559,7 +2559,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/nunomaduro/termwind/issues", "issues": "https://github.com/nunomaduro/termwind/issues",
"source": "https://github.com/nunomaduro/termwind/tree/v2.3.1" "source": "https://github.com/nunomaduro/termwind/tree/v2.3.2"
}, },
"funding": [ "funding": [
{ {
@@ -2575,7 +2575,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-05-08T08:14:37+00:00" "time": "2025-10-18T11:10:27+00:00"
}, },
{ {
"name": "phpoption/phpoption", "name": "phpoption/phpoption",
@@ -6032,28 +6032,28 @@
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
"version": "1.11.0", "version": "1.12.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/webmozarts/assert.git", "url": "https://github.com/webmozarts/assert.git",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" "reference": "541057574806f942c94662b817a50f63f7345360"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", "url": "https://api.github.com/repos/webmozarts/assert/zipball/541057574806f942c94662b817a50f63f7345360",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", "reference": "541057574806f942c94662b817a50f63f7345360",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-ctype": "*", "ext-ctype": "*",
"ext-date": "*",
"ext-filter": "*",
"php": "^7.2 || ^8.0" "php": "^7.2 || ^8.0"
}, },
"conflict": { "suggest": {
"phpstan/phpstan": "<0.12.20", "ext-intl": "",
"vimeo/psalm": "<4.6.1 || 4.6.2" "ext-simplexml": "",
}, "ext-spl": ""
"require-dev": {
"phpunit/phpunit": "^8.5.13"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@@ -6084,9 +6084,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/webmozarts/assert/issues", "issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.11.0" "source": "https://github.com/webmozarts/assert/tree/1.12.0"
}, },
"time": "2022-06-03T18:03:27+00:00" "time": "2025-10-20T12:43:39+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@@ -0,0 +1,28 @@
<?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('notifications', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('content');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('notifications');
}
};
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"name": "sae-back", "name": "backend",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {