agenciafmd/admix-postal

Postal - Agência F&MD
7,024
Install
composer require agenciafmd/admix-postal
Latest Version:1.0.0
License:MIT
Last Updated:Apr 22, 2025
Links: GitHub  ·  Packagist
Maintainer: agenciafmd

F&MD - Postal

Área Administrativa

Downloads Licença

  • Map all forms from your application and send them to specific emails

Installation

composer require agenciafmd/admix-postal:dev-master

Run the migrations

php artisan migrate

If you want to use the seeder, run

php artisan vendor:publish --tag=admix-postal:seeders

Usage

    // if you want to send attachments
    $attachments = null;
    if ($request->has('images')) {
        $images = $request->file('images');
        foreach ($images as $image) {
            $customName = Str::of($request->name)->slug() . '-' . Str::random(5) . '.' . $image->getClientOriginalExtension();
            /* TODO: refactor with Storage */
            $attachments[] = storage_path(
                'app/' . $image
                    ->storeAs('attachments', $customName, 'local')
            );
        }
    }

    // fill if you want to customize the subject
    $customSubject = null;
    Postal::query()
        ->where('slug', 'slug-of-created-form')
        ->first()
        ->notify(new SendNotification([
            'greeting' => $request->subject,
            'introLines' => [
                '**Nome:** ' . $request->name,
                '**E-mail:** ' . $request->email,
                '**Telefone:** ' . $request->phone,
                '**Cidade:** ' . $request->city . ' - ' . $request->state,
                '**Mensagem:** ' . nl2br($request->message),
            ],
        ], [$request->email => $request->name], $attachments, $customSubject));

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

637,827,751 9,703
laravel/framework

The Laravel Framework.

589,172,971 34,950
laravel/tinker

Powerful REPL for the Laravel framework.

498,216,183 7,442
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

413,412,504 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

391,429,217 4,660