trevorpan
6 months ago

Email best practice: messages & controllers & tables

Posted 6 months ago by trevorpan

When creating a site that has authenticated users (with account) and potential new users (no account) do you typically create a PublicMessagesController for public messages e.g. on the navbar, and an internal (authenticated) SupportsController?

<?php

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

class PublicMessagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('publicmessages', function (Blueprint $table) {
            $table->increments('id');
            $table->string('firstname');
            $table->string('lastname');
            $table->string('email')->unique();
            $table->text('message');
            $table->timestamps();
        });
    }

Just whipped this up. And am thinking about the future of the site. Should a controller & table like this include a user_id and force people to signup? Seems kind of pushy. What if they're just dipping their toes? But it'd be nice to associate all messages with a user.

Does this happen in the email response? Like, hey "messager" we love you emailed us, after we answer your question—create an account!

However, if they never sign up a message in the publicmessages table—it's like a misfit.

If you have any experience here, I'd love to see how other sites handle this. It's not particularly unique, but I think valuable.

Please sign in or create an account to participate in this conversation.