This is my first time to use Polymorphic Relationship. I plan to make a one to many relationship. So this is what I done so far.
I created three tables: User, Message, and Notification:
Heres the migration for the Notification:
Schema::create('notifications', function (Blueprint $table) {
$table->bigIncrements('id');
$table->char('title');
$table->string('body', 10000)->nullable();
$table->unsignedBigInteger('causer_id'); //creator for notification
$table->char('causer');
$table->unsignedBigInteger('subject_id'); //receiver for notification
$table->char('subject');
$table->timestamps();
});
I expect values something like this:
My problem is, I am really confuse how to make my model relationship, and how to create a model function for these things below:
- to create notifications
- to view notifications
- to edit a specific notification
Any ideas Sirs or suggestion to achieve these. Thanks in adv.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire