Pharaonic
Loading...

Getting Started

Messages

# Why Messages?

Messages is a package that provides an easy way to send messages (contact us) with attachment in Laravel.

This package depends on Has Files.

# Installation

Install the latest version using Composer.

1composer require pharaonic/laravel-messages
2php artisan migrate

# Send

This is how you can send a new message.

1use Pharaonic\Laravel\Messages\Message;
2 
3// Request Content
4// ===============
5// 1. message [string] (REQUIRED)
6// 2. name [string] (OPTIONAL)
7// 3. email [string] (OPTIONAL)
8// 4. mobile_country_code [string] (OPTIONAL)
9// 5. mobile_number [string] (OPTIONAL)
10// 6. subject [string] (OPTIONAL)
11// 7. attachment [file] (OPTIONAL)
12$message = Message::send($request);

# Retrieve

To retrieve a single message and it's information, just you have to it like this.

1use Pharaonic\Laravel\Messages\Message;
2 
3// If sender was an auth user
4$message->sender;
5 
6// Mark as read
7$message->markAsRead();
8 
9// Attachment file
10$message->attachment;
11 
12// Check if messaging allowed by minutes (10)
13if(Message::messageable($request, 10)) {
14 //
15}

# Directives

This is how you can check if messaging allowed by minutes (10).

1@messageable(10)
2 Yes
3@else
4 No
5@endmessageable

# Publish migrations

You can publish the migrations

1php artisan vendor:publish --tag=laravel-messages

# Contributors

MoamenEltouny
6 Contributions
komtcho
1 Contributions