<file_sep># Villain Mail

A villains-only messages application.

## Installation

1. Clone source code from url https://github.com/trenshaw88/Villain-Mail.git

2. Create a database

3. Create .env and add database credentials

4. Run migrations

# Heroku 

1. Open browser, navigate to url https://villian-mail.herokuapp.com/

<file_sep><?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Sent extends Model
{

	  public function messages() {
    return $this->hasMany('App\Message')->orderBy('recipient_id', 'desc');
  }

      public static function sent_messages() {

      // $condition = \App\Condition::find(2);
      $sent_messages = DB::table('messages')
                      ->orderBy('created_at', 'desc')
                      ->get();

      return $sent_messages;

    }
	  public function recipient() {
    return $this->belongsTo('App\Message', 'recipient_id');
  }
}
  