Files
monica/app/Gift.php
T
Régis Freyd 208f6a0ee0 Remove encryption on the Gifts table (#249)
This is just causing too much headache, especially since I made the rookie mistake of not checking the max length of some entries when inserting the gift. That leads to errors in the decryption process.

In production, out of the thousands of gifts already entered, only 5 are not decryptable. I have no other choice than resetting these 5 rows. I'm really sorry about this.

If you do end up having problems running the migration in your own instance, you need to remove the rows that are un-decryptable in the Gifts table as well.
2017-06-13 00:16:10 -04:00

82 lines
1.4 KiB
PHP

<?php
namespace App;
use App\Helpers\DateHelper;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class Gift extends Model
{
protected $dates = [
'date_offered',
];
/**
* Get the account record associated with the gift.
*/
public function account()
{
return $this->belongsTo('App\Account');
}
/**
* Get the contact record associated with the gift.
*/
public function contact()
{
return $this->belongsTo('App\Contact');
}
public function scopeOffered(Builder $query)
{
return $query->where('has_been_offered', 'true');
}
public function scopeIsIdea(Builder $query)
{
return $query->where('is_an_idea', 'true');
}
public function getName()
{
if (is_null($this->name)) {
return null;
}
return $this->name;
}
public function getUrl()
{
if (is_null($this->url)) {
return null;
}
return $this->url;
}
public function getComment()
{
if (is_null($this->comment)) {
return null;
}
return $this->comment;
}
public function getValue()
{
if (is_null($this->value_in_dollars)) {
return null;
}
return $this->value_in_dollars;
}
public function getCreatedAt()
{
return $this->created_at;
}
}