Add style CI (#503)
Hopefully this will result in slightly better code.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
preset: laravel
|
||||
+10
-12
@@ -4,10 +4,9 @@ namespace App;
|
||||
|
||||
use DB;
|
||||
use Laravel\Cashier\Billable;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
/**
|
||||
* @property User $user
|
||||
@@ -27,7 +26,6 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
*/
|
||||
class Account extends Model
|
||||
{
|
||||
|
||||
use Billable;
|
||||
|
||||
/**
|
||||
@@ -36,7 +34,7 @@ class Account extends Model
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'number_of_invitations_sent', 'api_key'
|
||||
'number_of_invitations_sent', 'api_key',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -210,7 +208,7 @@ class Account extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the account can be downgraded, based on a set of rules
|
||||
* Check if the account can be downgraded, based on a set of rules.
|
||||
*
|
||||
* @return this
|
||||
*/
|
||||
@@ -234,9 +232,9 @@ class Account extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the account is currently subscribed to a plan
|
||||
* Check if the account is currently subscribed to a plan.
|
||||
*
|
||||
* @return boolean $isSubscribed
|
||||
* @return bool $isSubscribed
|
||||
*/
|
||||
public function isSubscribed()
|
||||
{
|
||||
@@ -254,7 +252,7 @@ class Account extends Model
|
||||
* This was created because Laravel Cashier doesn't know how to properly
|
||||
* handled the case when a user doesn't have invoices yet. This sucks balls.
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasInvoices()
|
||||
{
|
||||
@@ -267,16 +265,16 @@ class Account extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next billing date for the account
|
||||
* Get the next billing date for the account.
|
||||
*
|
||||
* @return String $timestamp
|
||||
* @return string $timestamp
|
||||
*/
|
||||
public function getNextBillingDate()
|
||||
{
|
||||
// Weird method to get the next billing date from Laravel Cashier
|
||||
// see https://stackoverflow.com/questions/41576568/get-next-billing-date-from-laravel-cashier
|
||||
$timestamp = $this->asStripeCustomer()["subscriptions"]
|
||||
->data[0]["current_period_end"];
|
||||
$timestamp = $this->asStripeCustomer()['subscriptions']
|
||||
->data[0]['current_period_end'];
|
||||
|
||||
return \App\Helpers\DateHelper::getShortDate($timestamp);
|
||||
}
|
||||
|
||||
+1
-3
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\ActivityType;
|
||||
use App\Helpers\DateHelper;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -74,7 +72,7 @@ class Activity extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date_it_happened field according to user's timezone
|
||||
* Get the date_it_happened field according to user's timezone.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\ActivityTypeGroup;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ActivityType extends Model
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
|
||||
@@ -47,13 +47,15 @@ class ImportCSV extends Command
|
||||
$user = User::where('email', $this->argument('user'))->first();
|
||||
}
|
||||
|
||||
if (!file_exists($file)) {
|
||||
if (! file_exists($file)) {
|
||||
$this->error('You need to provide a valid file path.');
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!$user) {
|
||||
if (! $user) {
|
||||
$this->error('You need to provide a valid User ID or email address!');
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -61,8 +63,8 @@ class ImportCSV extends Command
|
||||
|
||||
$row = 0;
|
||||
$imported = 0;
|
||||
if (($handle = fopen($file, "r")) !== FALSE) {
|
||||
while (($data = fgetcsv($handle)) !== FALSE) {
|
||||
if (($handle = fopen($file, 'r')) !== false) {
|
||||
while (($data = fgetcsv($handle)) !== false) {
|
||||
$row++;
|
||||
|
||||
// don't import the columns
|
||||
@@ -78,51 +80,51 @@ class ImportCSV extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($data[1])) {
|
||||
if (! empty($data[1])) {
|
||||
$contact->first_name = $data[1]; // Given Name
|
||||
}
|
||||
|
||||
if (!empty($data[2])) {
|
||||
if (! empty($data[2])) {
|
||||
$contact->middle_name = $data[2]; // Additional Name
|
||||
}
|
||||
|
||||
if (!empty($data[3])) {
|
||||
if (! empty($data[3])) {
|
||||
$contact->last_name = $data[3]; // Family Name
|
||||
}
|
||||
|
||||
if (!empty($data[14])) {
|
||||
if (! empty($data[14])) {
|
||||
$contact->birthdate = date('Y-m-d', strtotime($data[14]));
|
||||
}
|
||||
|
||||
if (!empty($data[28])) {
|
||||
if (! empty($data[28])) {
|
||||
$contact->email = $data[28]; // Email 1 Value
|
||||
}
|
||||
|
||||
if (!empty($data[42])) {
|
||||
if (! empty($data[42])) {
|
||||
$contact->phone_number = $data[42]; // Phone 1 Value
|
||||
}
|
||||
|
||||
if (!empty($data[49])) {
|
||||
if (! empty($data[49])) {
|
||||
$contact->street = $data[49]; // address 1 street
|
||||
}
|
||||
|
||||
if (!empty($data[50])) {
|
||||
if (! empty($data[50])) {
|
||||
$contact->city = $data[50]; // address 1 city
|
||||
}
|
||||
if (!empty($data[52])) {
|
||||
if (! empty($data[52])) {
|
||||
$contact->province = $data[52]; // address 1 region (state)
|
||||
}
|
||||
|
||||
if (!empty($data[53])) {
|
||||
if (! empty($data[53])) {
|
||||
$contact->postal_code = $data[53]; // address 1 postal code (zip) 53
|
||||
}
|
||||
if (!empty($data[66])) {
|
||||
if (! empty($data[66])) {
|
||||
$contact->job = $data[66]; // organization 1 name 66
|
||||
}
|
||||
|
||||
// can't have empty email
|
||||
if (empty($contact->email)) {
|
||||
$contact->email = NULL;
|
||||
$contact->email = null;
|
||||
}
|
||||
|
||||
$contact->save();
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\User;
|
||||
use App\Contact;
|
||||
use App\Country;
|
||||
use App\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Sabre\VObject\Component\VCard;
|
||||
use Sabre\VObject\Property\ICalendar\DateTime;
|
||||
use Sabre\VObject\Reader;
|
||||
use Illuminate\Console\Command;
|
||||
use Sabre\VObject\Component\VCard;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class ImportVCards extends Command
|
||||
{
|
||||
@@ -45,16 +44,17 @@ class ImportVCards extends Command
|
||||
*/
|
||||
public function handle(Filesystem $filesystem)
|
||||
{
|
||||
$path = './' . $this->argument('path');
|
||||
$path = './'.$this->argument('path');
|
||||
|
||||
$user = User::where('email', $this->argument('user'))->first();
|
||||
|
||||
if (!$user) {
|
||||
if (! $user) {
|
||||
$this->error('You need to provide a valid user email!');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$filesystem->exists($path) || $filesystem->extension($path) !== 'vcf') {
|
||||
if (! $filesystem->exists($path) || $filesystem->extension($path) !== 'vcf') {
|
||||
$this->error('The provided vcard file was not found or is not valid!');
|
||||
|
||||
return;
|
||||
@@ -65,7 +65,6 @@ class ImportVCards extends Command
|
||||
$this->info("We found {$matchCount} contacts in {$path}.");
|
||||
|
||||
if ($this->confirm('Would you like to import them?', true)) {
|
||||
|
||||
$this->info("Importing contacts from {$path}");
|
||||
|
||||
$this->output->progressStart($matchCount);
|
||||
@@ -75,7 +74,6 @@ class ImportVCards extends Command
|
||||
collect($matches[0])->map(function ($vcard) {
|
||||
return Reader::read($vcard);
|
||||
})->each(function (VCard $vcard) use ($user, $skippedContacts) {
|
||||
|
||||
if ($this->contactExists($vcard, $user)) {
|
||||
$this->output->progressAdvance();
|
||||
$skippedContacts++;
|
||||
@@ -94,7 +92,7 @@ class ImportVCards extends Command
|
||||
$contact = new Contact();
|
||||
$contact->account_id = $user->account_id;
|
||||
|
||||
if($vcard->N && ! empty($vcard->N->getParts()[1])) {
|
||||
if ($vcard->N && ! empty($vcard->N->getParts()[1])) {
|
||||
$contact->first_name = $this->formatValue($vcard->N->getParts()[1]);
|
||||
$contact->middle_name = $this->formatValue($vcard->N->getParts()[2]);
|
||||
$contact->last_name = $this->formatValue($vcard->N->getParts()[0]);
|
||||
@@ -105,14 +103,14 @@ class ImportVCards extends Command
|
||||
$contact->gender = 'none';
|
||||
$contact->is_birthdate_approximate = 'unknown';
|
||||
|
||||
if ($vcard->BDAY && !empty((string) $vcard->BDAY)) {
|
||||
if ($vcard->BDAY && ! empty((string) $vcard->BDAY)) {
|
||||
$contact->birthdate = new \DateTime((string) $vcard->BDAY);
|
||||
}
|
||||
|
||||
$contact->email = $this->formatValue($vcard->EMAIL);
|
||||
$contact->phone_number = $this->formatValue($vcard->TEL);
|
||||
|
||||
if($vcard->ADR) {
|
||||
if ($vcard->ADR) {
|
||||
$contact->street = $this->formatValue($vcard->ADR->getParts()[2]);
|
||||
$contact->city = $this->formatValue($vcard->ADR->getParts()[3]);
|
||||
$contact->province = $this->formatValue($vcard->ADR->getParts()[4]);
|
||||
@@ -142,22 +140,21 @@ class ImportVCards extends Command
|
||||
|
||||
$this->info("Successfully imported {$matchCount} contacts and skipped {$skippedContacts}.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats and returns a string for the contact
|
||||
* Formats and returns a string for the contact.
|
||||
*
|
||||
* @param null|string $value
|
||||
* @return null|string
|
||||
*/
|
||||
private function formatValue($value)
|
||||
{
|
||||
return !empty((string) $value) ? (string) $value : null;
|
||||
return ! empty((string) $value) ? (string) $value : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a contact already exists for a given account
|
||||
* Checks whether a contact already exists for a given account.
|
||||
*
|
||||
* @param VCard $vcard
|
||||
* @param User $user
|
||||
@@ -169,7 +166,7 @@ class ImportVCards extends Command
|
||||
|
||||
$contact = Contact::where([
|
||||
['account_id', $user->account_id],
|
||||
['email', $email]
|
||||
['email', $email],
|
||||
])->first();
|
||||
|
||||
return $email && $contact;
|
||||
@@ -182,7 +179,7 @@ class ImportVCards extends Command
|
||||
* @param VCard $vcard
|
||||
* @return bool
|
||||
*/
|
||||
function contactHasName(VCard $vcard): bool
|
||||
public function contactHasName(VCard $vcard): bool
|
||||
{
|
||||
return ! empty($vcard->N->getParts()[1]) || ! empty((string) $vcard->NICKNAME);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Log;
|
||||
use App\Contact;
|
||||
use App\Instance;
|
||||
use Illuminate\Console\Command;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class PingVersionServer extends Command
|
||||
{
|
||||
@@ -55,18 +54,18 @@ class PingVersionServer extends Command
|
||||
$json = [
|
||||
'uuid' => $instance->uuid,
|
||||
'version' => $instance->current_version,
|
||||
'contacts' => Contact::count()
|
||||
'contacts' => Contact::count(),
|
||||
];
|
||||
|
||||
$data["uuid"] = $instance->uuid;
|
||||
$data["version"] = $instance->current_version;
|
||||
$data["contacts"] = Contact::all()->count();
|
||||
$data['uuid'] = $instance->uuid;
|
||||
$data['version'] = $instance->current_version;
|
||||
$data['contacts'] = Contact::all()->count();
|
||||
|
||||
// Send the JSON
|
||||
try {
|
||||
$client = new Client();
|
||||
$response = $client->post(config('monica.weekly_ping_server_url'), [
|
||||
'json' => $data
|
||||
'json' => $data,
|
||||
]);
|
||||
} catch (\GuzzleHttp\Exception\ConnectException $e) {
|
||||
return;
|
||||
|
||||
@@ -39,7 +39,7 @@ class ResetTestDB extends Command
|
||||
public function handle()
|
||||
{
|
||||
if (config('app.env') == 'local') {
|
||||
foreach(\DB::select('SHOW TABLES') as $table) {
|
||||
foreach (\DB::select('SHOW TABLES') as $table) {
|
||||
$table_array = get_object_vars($table);
|
||||
\Schema::drop($table_array[key($table_array)]);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Log;
|
||||
use App\User;
|
||||
use App\Account;
|
||||
use App\Contact;
|
||||
use App\Reminder;
|
||||
use Carbon\Carbon;
|
||||
use App\Jobs\SendReminderEmail;
|
||||
|
||||
@@ -7,7 +7,6 @@ use Illuminate\Console\ConfirmableTrait;
|
||||
|
||||
class SetupProduction extends Command
|
||||
{
|
||||
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
@@ -47,8 +46,7 @@ class SetupProduction extends Command
|
||||
* If the .env file does not exist, then key generation
|
||||
* will fail. So we create one if it does not already exist.
|
||||
*/
|
||||
if( ! file_exists('.env') )
|
||||
{
|
||||
if (! file_exists('.env')) {
|
||||
touch('.env');
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class Kernel extends ConsoleKernel
|
||||
'App\Console\Commands\ImportCSV',
|
||||
'App\Console\Commands\SetupProduction',
|
||||
'App\Console\Commands\ImportVCards',
|
||||
'App\Console\Commands\PingVersionServer'
|
||||
'App\Console\Commands\PingVersionServer',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
+52
-59
@@ -2,17 +2,15 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Auth;
|
||||
use App\Call;
|
||||
use Carbon\Carbon;
|
||||
use App\Traits\Searchable;
|
||||
use App\Helpers\DateHelper;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\Searchable;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Contact extends Model
|
||||
{
|
||||
@@ -20,7 +18,7 @@ class Contact extends Model
|
||||
|
||||
protected $dates = [
|
||||
'birthdate',
|
||||
'last_talked_to'
|
||||
'last_talked_to',
|
||||
];
|
||||
|
||||
// The list of columns we want the Searchable trait to use.
|
||||
@@ -35,7 +33,7 @@ class Contact extends Model
|
||||
'province',
|
||||
'food_preferencies',
|
||||
'job',
|
||||
'company'
|
||||
'company',
|
||||
];
|
||||
|
||||
// The list of columns we want the Searchable trait to select.
|
||||
@@ -47,7 +45,7 @@ class Contact extends Model
|
||||
'has_avatar',
|
||||
'avatar_file_name',
|
||||
'gravatar_url',
|
||||
'default_avatar_color'
|
||||
'default_avatar_color',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -215,7 +213,7 @@ class Contact extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the contacts according a given criteria
|
||||
* Sort the contacts according a given criteria.
|
||||
* @param Builder $builder
|
||||
* @param string $criteria
|
||||
* @return Builder
|
||||
@@ -234,11 +232,10 @@ class Contact extends Model
|
||||
default:
|
||||
return $builder->orderBy('first_name', 'asc');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user's initials
|
||||
* Get user's initials.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -261,23 +258,23 @@ class Contact extends Model
|
||||
if ($nameOrder == 'firstname_first') {
|
||||
$completeName = $this->first_name;
|
||||
|
||||
if (!is_null($this->middle_name)) {
|
||||
$completeName = $completeName . ' ' . $this->middle_name;
|
||||
if (! is_null($this->middle_name)) {
|
||||
$completeName = $completeName.' '.$this->middle_name;
|
||||
}
|
||||
|
||||
if (!is_null($this->last_name)) {
|
||||
$completeName = $completeName . ' ' . $this->last_name;
|
||||
if (! is_null($this->last_name)) {
|
||||
$completeName = $completeName.' '.$this->last_name;
|
||||
}
|
||||
} else {
|
||||
if (!is_null($this->last_name)) {
|
||||
if (! is_null($this->last_name)) {
|
||||
$completeName = $this->last_name;
|
||||
}
|
||||
|
||||
if (!is_null($this->middle_name)) {
|
||||
$completeName = $completeName . ' ' . $this->middle_name;
|
||||
if (! is_null($this->middle_name)) {
|
||||
$completeName = $completeName.' '.$this->middle_name;
|
||||
}
|
||||
|
||||
$completeName = $completeName . ' ' . $this->first_name;
|
||||
$completeName = $completeName.' '.$this->first_name;
|
||||
}
|
||||
|
||||
return $completeName;
|
||||
@@ -331,7 +328,7 @@ class Contact extends Model
|
||||
public function getLastActivityDate($timezone)
|
||||
{
|
||||
if ($this->activities->count() === 0) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
$lastActivity = $this->activities->sortByDesc('date_it_happened')->first();
|
||||
@@ -349,7 +346,7 @@ class Contact extends Model
|
||||
public function getLastCalled($timezone)
|
||||
{
|
||||
if (is_null($this->last_talked_to)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return DateHelper::getShortDate(
|
||||
@@ -365,7 +362,7 @@ class Contact extends Model
|
||||
public function getBirthdate()
|
||||
{
|
||||
if (is_null($this->birthdate)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->birthdate;
|
||||
@@ -380,7 +377,7 @@ class Contact extends Model
|
||||
public function getAge()
|
||||
{
|
||||
if (is_null($this->birthdate)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->birthdate->diffInYears(Carbon::now());
|
||||
@@ -394,7 +391,7 @@ class Contact extends Model
|
||||
public function getPhone()
|
||||
{
|
||||
if (is_null($this->phone_number)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->phone_number;
|
||||
@@ -408,7 +405,7 @@ class Contact extends Model
|
||||
public function getJob()
|
||||
{
|
||||
if (is_null($this->job)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->job;
|
||||
@@ -422,14 +419,14 @@ class Contact extends Model
|
||||
public function getCompany()
|
||||
{
|
||||
if (is_null($this->company)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->company;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns 'true' if the birthdate is an approximation
|
||||
* Returns 'true' if the birthdate is an approximation.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -456,11 +453,11 @@ class Contact extends Model
|
||||
$address = $this->getCity();
|
||||
|
||||
if (is_null($address)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_null($this->getProvince())) {
|
||||
$address = $address . ', ' . $this->getProvince();
|
||||
if (! is_null($this->getProvince())) {
|
||||
$address = $address.', '.$this->getProvince();
|
||||
}
|
||||
|
||||
return $address;
|
||||
@@ -474,7 +471,7 @@ class Contact extends Model
|
||||
public function getStreet()
|
||||
{
|
||||
if (is_null($this->street)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->street;
|
||||
@@ -488,7 +485,7 @@ class Contact extends Model
|
||||
public function getProvince()
|
||||
{
|
||||
if (is_null($this->province)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->province;
|
||||
@@ -502,7 +499,7 @@ class Contact extends Model
|
||||
public function getPostalCode()
|
||||
{
|
||||
if (is_null($this->postal_code)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->postal_code;
|
||||
@@ -518,8 +515,6 @@ class Contact extends Model
|
||||
if ($this->country) {
|
||||
return $this->country->country;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -530,7 +525,7 @@ class Contact extends Model
|
||||
public function getCity()
|
||||
{
|
||||
if (is_null($this->city)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->city;
|
||||
@@ -556,8 +551,6 @@ class Contact extends Model
|
||||
if ($this->country) {
|
||||
return $this->country->iso;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -621,7 +614,7 @@ class Contact extends Model
|
||||
public function getEmail()
|
||||
{
|
||||
if (is_null($this->email)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->email;
|
||||
@@ -635,7 +628,7 @@ class Contact extends Model
|
||||
public function getTwitter()
|
||||
{
|
||||
if (is_null($this->twitter_profile_url)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->twitter_profile_url;
|
||||
@@ -649,7 +642,7 @@ class Contact extends Model
|
||||
public function getFacebook()
|
||||
{
|
||||
if (is_null($this->facebook_profile_url)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->facebook_profile_url;
|
||||
@@ -663,7 +656,7 @@ class Contact extends Model
|
||||
public function getLinkedin()
|
||||
{
|
||||
if (is_null($this->linkedin_profile_url)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->linkedin_profile_url;
|
||||
@@ -717,7 +710,7 @@ class Contact extends Model
|
||||
public function getFoodPreferencies()
|
||||
{
|
||||
if (is_null($this->food_preferencies)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->food_preferencies;
|
||||
@@ -793,11 +786,11 @@ class Contact extends Model
|
||||
|
||||
$this->first_name = $firstName;
|
||||
|
||||
if (!is_null($middleName)) {
|
||||
if (! is_null($middleName)) {
|
||||
$this->middle_name = $middleName;
|
||||
}
|
||||
|
||||
if (!is_null($lastName)) {
|
||||
if (! is_null($lastName)) {
|
||||
$this->last_name = $lastName;
|
||||
}
|
||||
|
||||
@@ -850,7 +843,7 @@ class Contact extends Model
|
||||
$activityStatistic = $this->activityStatistics()->create([]);
|
||||
$activityStatistic->account_id = $this->account_id;
|
||||
$activityStatistic->year = $year;
|
||||
$activityStatistic->count = $activities->count();;
|
||||
$activityStatistic->count = $activities->count();
|
||||
$activityStatistic->save();
|
||||
});
|
||||
}
|
||||
@@ -925,7 +918,7 @@ class Contact extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL of the avatar with the given size
|
||||
* Returns the URL of the avatar with the given size.
|
||||
*
|
||||
* @param int $size
|
||||
* @return string
|
||||
@@ -935,7 +928,7 @@ class Contact extends Model
|
||||
$original_avatar_url = Storage::disk('public')->url($this->avatar_file_name);
|
||||
$avatar_filename = pathinfo($original_avatar_url, PATHINFO_FILENAME);
|
||||
$avatar_extension = pathinfo($original_avatar_url, PATHINFO_EXTENSION);
|
||||
$resized_avatar = 'avatars/' . $avatar_filename . '_' . $size . '.' . $avatar_extension;
|
||||
$resized_avatar = 'avatars/'.$avatar_filename.'_'.$size.'.'.$avatar_extension;
|
||||
|
||||
return Storage::disk('public')->url($resized_avatar);
|
||||
}
|
||||
@@ -943,28 +936,28 @@ class Contact extends Model
|
||||
/**
|
||||
* Get the gravatar, if it exits.
|
||||
*
|
||||
* @param integer $size
|
||||
* @return string|boolean
|
||||
* @param int $size
|
||||
* @return string|bool
|
||||
*/
|
||||
public function getGravatar($size)
|
||||
{
|
||||
if (empty($this->email)) {
|
||||
return false;
|
||||
}
|
||||
$gravatar_url = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->email)));
|
||||
$gravatar_url = 'https://www.gravatar.com/avatar/'.md5(strtolower(trim($this->email)));
|
||||
// check if gravatar exists by appending ?d=404, returns 404 response if does not exist
|
||||
$gravatarHeaders = get_headers($gravatar_url . "?d=404");
|
||||
if ($gravatarHeaders[0] == "HTTP/1.1 404 Not Found") {
|
||||
$gravatarHeaders = get_headers($gravatar_url.'?d=404');
|
||||
if ($gravatarHeaders[0] == 'HTTP/1.1 404 Not Found') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $gravatar_url . "?s=" . $size;
|
||||
return $gravatar_url.'?s='.$size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the contact has debt (by the contact or the user for this contact)
|
||||
* Check if the contact has debt (by the contact or the user for this contact).
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDebt()
|
||||
{
|
||||
@@ -980,11 +973,11 @@ class Contact extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of tags as a string to populate the tags form
|
||||
* Get the list of tags as a string to populate the tags form.
|
||||
*/
|
||||
public function getTagsAsString()
|
||||
{
|
||||
$tags = array();
|
||||
$tags = [];
|
||||
|
||||
foreach ($this->tags as $tag) {
|
||||
array_push($tags, $tag->name);
|
||||
|
||||
+3
-3
@@ -38,7 +38,7 @@ class Debt extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit results to unpaid/unreceived debt
|
||||
* Limit results to unpaid/unreceived debt.
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
@@ -49,7 +49,7 @@ class Debt extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit results to due debt
|
||||
* Limit results to due debt.
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
@@ -60,7 +60,7 @@ class Debt extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit results to owed debt
|
||||
* Limit results to owed debt.
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ class Entry extends Model
|
||||
public function getPost()
|
||||
{
|
||||
if (is_null($this->post)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->post;
|
||||
@@ -28,7 +28,7 @@ class Entry extends Model
|
||||
public function getTitle()
|
||||
{
|
||||
if (is_null($this->title)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->title;
|
||||
|
||||
+3
-4
@@ -2,9 +2,8 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Auth;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
@@ -35,7 +34,7 @@ class Event extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Limits the results to a specific object
|
||||
* Limits the results to a specific object.
|
||||
*
|
||||
* @param Builder $query
|
||||
* @param Model $object
|
||||
@@ -44,7 +43,7 @@ class Event extends Model
|
||||
*/
|
||||
public function scopeForObject(Builder $query, Model $object, string $key = null)
|
||||
{
|
||||
if (!$key) {
|
||||
if (! $key) {
|
||||
$key = strtolower(class_basename($object));
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class Handler extends ExceptionHandler
|
||||
{
|
||||
// hopefully catches those pesky token expiries
|
||||
// and send them back to login.
|
||||
if ( $e instanceof TokenMismatchException ){
|
||||
if ($e instanceof TokenMismatchException) {
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
|
||||
+5
-7
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ class Gift extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit results to already offered gifts
|
||||
* Limit results to already offered gifts.
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
@@ -78,7 +78,7 @@ class Gift extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit results to gifts at the idea stage
|
||||
* Limit results to gifts at the idea stage.
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
@@ -90,7 +90,7 @@ class Gift extends Model
|
||||
|
||||
/**
|
||||
* Check whether the gift is meant for a particular member
|
||||
* of the contact's family
|
||||
* of the contact's family.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -100,7 +100,7 @@ class Gift extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the recipient for the gift
|
||||
* Set the recipient for the gift.
|
||||
*
|
||||
* @param SignificantOther|Kid|string $recipient
|
||||
* @return static
|
||||
@@ -123,8 +123,6 @@ class Gift extends Model
|
||||
if ($this->hasParticularRecipient()) {
|
||||
return $this->recipient->first_name;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
|
||||
@@ -97,10 +97,10 @@ class DateHelper
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a given number of week/month/year to a date
|
||||
* Add a given number of week/month/year to a date.
|
||||
* @param Carbon $date the start date
|
||||
* @param string $frequency week/month/year
|
||||
* @param integer $number the number of week/month/year to increment to
|
||||
* @param int $number the number of week/month/year to increment to
|
||||
*/
|
||||
public static function addTimeAccordingToFrequencyType(Carbon $date, $frequency, $number)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ class MoneyHelper
|
||||
break;
|
||||
}
|
||||
|
||||
$amount = $currency->symbol . $amount;
|
||||
$amount = $currency->symbol.$amount;
|
||||
}
|
||||
|
||||
return (string) $amount;
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Auth;
|
||||
|
||||
use Auth;
|
||||
use App\User;
|
||||
use Socialite;
|
||||
use Validator;
|
||||
use App\Account;
|
||||
use Carbon\Carbon;
|
||||
|
||||
@@ -21,7 +21,7 @@ class ResetPasswordController extends Controller
|
||||
use ResetsPasswords;
|
||||
|
||||
protected $redirectTo = '/dashboard';
|
||||
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
|
||||
@@ -6,7 +6,6 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesResources;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
|
||||
@@ -3,16 +3,11 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use App\Event;
|
||||
use App\Task;
|
||||
use App\Debt;
|
||||
use Validator;
|
||||
use App\Event;
|
||||
use App\Contact;
|
||||
use App\Reminder;
|
||||
use Carbon\Carbon;
|
||||
use App\Http\Requests;
|
||||
use App\Helpers\DateHelper;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
@@ -54,7 +49,6 @@ class DashboardController extends Controller
|
||||
return $event->contact === null;
|
||||
})
|
||||
->map(function (Event $event) use ($account) {
|
||||
|
||||
if ($event->object_type === 'significantother') {
|
||||
$object = $event->contact->significantOthers->where('id', $event->object_id)->first();
|
||||
} elseif ($event->object_type === 'kid') {
|
||||
@@ -99,7 +93,7 @@ class DashboardController extends Controller
|
||||
'debt_owed' => $debt_owed,
|
||||
'tasks' => $tasks,
|
||||
'debts' => $debt,
|
||||
'user' => auth()->user()
|
||||
'user' => auth()->user(),
|
||||
];
|
||||
|
||||
return view('dashboard.index', $data);
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -5,8 +5,6 @@ namespace App\Http\Controllers;
|
||||
use Auth;
|
||||
use App\Entry;
|
||||
use Validator;
|
||||
use Carbon\Carbon;
|
||||
use App\Http\Requests;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class JournalController extends Controller
|
||||
@@ -35,7 +33,7 @@ class JournalController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the journal entry
|
||||
* Saves the journal entry.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
@@ -57,7 +55,7 @@ class JournalController extends Controller
|
||||
$entry->post = $request->input('entry');
|
||||
|
||||
if ($request->input('title') != '') {
|
||||
$entry->title = $request->input('title');
|
||||
$entry->title = $request->input('title');
|
||||
}
|
||||
|
||||
$entry->save();
|
||||
|
||||
@@ -56,7 +56,7 @@ class ActivitiesController extends Controller
|
||||
$contact->logEvent('activity', $activity->id, 'create');
|
||||
$contact->calculateActivitiesStatistics();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.activities_add_success'));
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class ActivitiesController extends Controller
|
||||
$contact->logEvent('activity', $activity->id, 'update');
|
||||
$contact->calculateActivitiesStatistics();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.activities_update_success'));
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ class ActivitiesController extends Controller
|
||||
|
||||
$contact->calculateActivitiesStatistics();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.activities_delete_success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,8 @@ namespace App\Http\Controllers\People;
|
||||
|
||||
use App\Call;
|
||||
use App\Contact;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\People\CallsRequest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\People\CallsRequest;
|
||||
|
||||
class CallsController extends Controller
|
||||
{
|
||||
@@ -21,11 +20,11 @@ class CallsController extends Controller
|
||||
{
|
||||
$call = $contact->calls()->create(
|
||||
$request->only([
|
||||
'called_at'
|
||||
'called_at',
|
||||
])
|
||||
+ [
|
||||
'content' => ($request->get('content') == '' ? null : $request->get('content')),
|
||||
'account_id' => $contact->account_id
|
||||
'account_id' => $contact->account_id,
|
||||
]
|
||||
);
|
||||
|
||||
@@ -33,7 +32,7 @@ class CallsController extends Controller
|
||||
|
||||
$contact->updateLastCalledInfo($call);
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.calls_add_success'));
|
||||
}
|
||||
|
||||
@@ -59,7 +58,7 @@ class CallsController extends Controller
|
||||
$contact->save();
|
||||
}
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.call_delete_success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,13 +51,13 @@ class DebtController extends Controller
|
||||
])
|
||||
+ [
|
||||
'account_id' => $contact->account_id,
|
||||
'status' => 'inprogress'
|
||||
'status' => 'inprogress',
|
||||
]
|
||||
);
|
||||
|
||||
$contact->logEvent('debt', $debt->id, 'create');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.debt_add_success'));
|
||||
}
|
||||
|
||||
@@ -105,13 +105,13 @@ class DebtController extends Controller
|
||||
])
|
||||
+ [
|
||||
'account_id' => $contact->account_id,
|
||||
'status' => 'inprogress'
|
||||
'status' => 'inprogress',
|
||||
]
|
||||
);
|
||||
|
||||
$contact->logEvent('debt', $debt->id, 'update');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.debt_edit_success'));
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ class DebtController extends Controller
|
||||
|
||||
$contact->events()->forObject($debt)->get()->each->delete();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.debt_delete_success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\People;
|
||||
|
||||
use App\Contact;
|
||||
use App\Gift;
|
||||
use App\Http\Requests\People\GiftsRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Contact;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\People\GiftsRequest;
|
||||
|
||||
class GiftsController extends Controller
|
||||
{
|
||||
@@ -58,13 +57,13 @@ class GiftsController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
if($request->get('has_recipient')) {
|
||||
if ($request->get('has_recipient')) {
|
||||
$gift->forRecipient($request->get('recipient'))->save();
|
||||
}
|
||||
|
||||
$contact->logEvent('gift', $gift->id, 'create');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.gifts_add_success'));
|
||||
}
|
||||
|
||||
@@ -118,13 +117,13 @@ class GiftsController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
if($request->get('has_recipient')) {
|
||||
if ($request->get('has_recipient')) {
|
||||
$gift->forRecipient($request->get('recipient'))->save();
|
||||
}
|
||||
|
||||
$contact->logEvent('gift', $gift->id, 'update');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.gifts_update_success'));
|
||||
}
|
||||
|
||||
@@ -141,7 +140,7 @@ class GiftsController extends Controller
|
||||
|
||||
$contact->events()->forObject($gift)->get()->each->delete();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.gifts_delete_success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
namespace App\Http\Controllers\People;
|
||||
|
||||
use App\Contact;
|
||||
use App\Http\Requests\People\KidsRequest;
|
||||
use App\Kid;
|
||||
use App\Contact;
|
||||
use App\Reminder;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\People\KidsRequest;
|
||||
|
||||
class KidsController extends Controller
|
||||
{
|
||||
@@ -53,7 +52,7 @@ class KidsController extends Controller
|
||||
])
|
||||
+ [
|
||||
'account_id' => $contact->account_id,
|
||||
'food_preferencies' => $request->get('food_preferences')
|
||||
'food_preferencies' => $request->get('food_preferences'),
|
||||
]
|
||||
);
|
||||
|
||||
@@ -81,7 +80,7 @@ class KidsController extends Controller
|
||||
|
||||
$contact->logEvent('kid', $kid->id, 'create');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.kids_add_success'));
|
||||
}
|
||||
|
||||
@@ -129,7 +128,7 @@ class KidsController extends Controller
|
||||
])
|
||||
+ [
|
||||
'account_id' => $contact->account_id,
|
||||
'food_preferencies' => $request->get('food_preferences')
|
||||
'food_preferencies' => $request->get('food_preferences'),
|
||||
]
|
||||
);
|
||||
|
||||
@@ -167,7 +166,7 @@ class KidsController extends Controller
|
||||
|
||||
$contact->logEvent('kid', $kid->id, 'update');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.kids_update_success'));
|
||||
}
|
||||
|
||||
@@ -188,7 +187,7 @@ class KidsController extends Controller
|
||||
|
||||
$kid->delete();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.kids_delete_success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class NotesController extends Controller
|
||||
|
||||
$contact->logEvent('note', $note->id, 'create');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.notes_create_success'));
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class NotesController extends Controller
|
||||
|
||||
$contact->logEvent('note', $note->id, 'update');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.notes_update_success'));
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class NotesController extends Controller
|
||||
|
||||
$contact->events()->forObject($note)->get()->each->delete();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.notes_delete_success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,14 +49,14 @@ class RemindersController extends Controller
|
||||
'description',
|
||||
'frequency_type',
|
||||
'next_expected_date',
|
||||
'frequency_number'
|
||||
'frequency_number',
|
||||
])
|
||||
+ ['account_id' => $contact->account_id]
|
||||
);
|
||||
|
||||
$contact->logEvent('reminder', $reminder->id, 'create');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.reminders_create_success'));
|
||||
}
|
||||
|
||||
@@ -102,14 +102,14 @@ class RemindersController extends Controller
|
||||
'next_expected_date',
|
||||
'description',
|
||||
'frequency_type',
|
||||
'frequency_number'
|
||||
'frequency_number',
|
||||
])
|
||||
+ ['account_id' => $contact->account_id]
|
||||
);
|
||||
|
||||
$contact->logEvent('reminder', $reminder->id, 'update');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.reminders_update_success'));
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ class RemindersController extends Controller
|
||||
|
||||
$contact->events()->forObject($reminder)->get()->each->delete();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.reminders_delete_success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class SignificantOthersController extends Controller
|
||||
|
||||
$contact->logEvent('significantother', $significantOther->id, 'create');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.significant_other_add_success'));
|
||||
}
|
||||
|
||||
@@ -139,9 +139,9 @@ class SignificantOthersController extends Controller
|
||||
$request->get('age')
|
||||
);
|
||||
|
||||
if($significantOther->reminder) {
|
||||
if ($significantOther->reminder) {
|
||||
$significantOther->update([
|
||||
'birthday_reminder_id' => null
|
||||
'birthday_reminder_id' => null,
|
||||
]);
|
||||
|
||||
$significantOther->reminder->delete();
|
||||
@@ -168,7 +168,7 @@ class SignificantOthersController extends Controller
|
||||
|
||||
$contact->logEvent('significantother', $significantOther->id, 'update');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.significant_other_edit_success'));
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ class SignificantOthersController extends Controller
|
||||
*/
|
||||
public function destroy(Contact $contact, SignificantOther $significantOther)
|
||||
{
|
||||
if($significantOther->reminder) {
|
||||
if ($significantOther->reminder) {
|
||||
$significantOther->reminder->delete();
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class SignificantOthersController extends Controller
|
||||
|
||||
$significantOther->delete();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.significant_other_delete_success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace App\Http\Controllers\People;
|
||||
|
||||
use App\Contact;
|
||||
use App\Tag;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\People\TagsRequest;
|
||||
|
||||
@@ -21,7 +19,7 @@ class TagsController extends Controller
|
||||
public function update(TagsRequest $request, Contact $contact)
|
||||
{
|
||||
if (auth()->user()->account_id != $contact->account_id) {
|
||||
return response()->json(array('status' => 'no'));
|
||||
return response()->json(['status' => 'no']);
|
||||
}
|
||||
|
||||
$tags = explode(',', $request->input('tags'));
|
||||
@@ -29,14 +27,15 @@ class TagsController extends Controller
|
||||
// if we receive an empty string, that means all tags have been removed.
|
||||
if ($request->input('tags') == '') {
|
||||
$contact->tags()->detach();
|
||||
return response()->json(array('status' => 'no', 'tags' => ''));
|
||||
|
||||
return response()->json(['status' => 'no', 'tags' => '']);
|
||||
}
|
||||
|
||||
$tagsIDs = array();
|
||||
$tagsWithIdAndSlug = array();
|
||||
$tagsIDs = [];
|
||||
$tagsWithIdAndSlug = [];
|
||||
foreach ($tags as $tag) {
|
||||
$tag = auth()->user()->account->tags()->firstOrCreate([
|
||||
'name' => $tag
|
||||
'name' => $tag,
|
||||
]);
|
||||
|
||||
$tag->name_slug = str_slug($tag->name);
|
||||
@@ -47,16 +46,16 @@ class TagsController extends Controller
|
||||
// this is passed back in json to JS
|
||||
array_push($tagsWithIdAndSlug, [
|
||||
'id' => $tag->id,
|
||||
'slug' => $tag->name_slug
|
||||
'slug' => $tag->name_slug,
|
||||
]);
|
||||
}
|
||||
|
||||
$contact->tags()->sync($tagsIDs);
|
||||
|
||||
$response = array(
|
||||
$response = [
|
||||
'status' => 'yes',
|
||||
'tags' => $tagsWithIdAndSlug,
|
||||
);
|
||||
];
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
|
||||
@@ -46,17 +46,17 @@ class TasksController extends Controller
|
||||
$task = $contact->tasks()->create(
|
||||
$request->only([
|
||||
'title',
|
||||
'description'
|
||||
'description',
|
||||
])
|
||||
+ [
|
||||
'account_id' => $contact->account_id,
|
||||
'status' => 'inprogress'
|
||||
'status' => 'inprogress',
|
||||
]
|
||||
);
|
||||
|
||||
$contact->logEvent('task', $task->id, 'create');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.tasks_add_success'));
|
||||
}
|
||||
|
||||
@@ -99,14 +99,14 @@ class TasksController extends Controller
|
||||
'title',
|
||||
'status',
|
||||
'description',
|
||||
'completed_at'
|
||||
'completed_at',
|
||||
])
|
||||
+ ['account_id' => $contact->account_id]
|
||||
);
|
||||
|
||||
$contact->logEvent('task', $task->id, 'update');
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.tasks_update_success'));
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class TasksController extends Controller
|
||||
{
|
||||
$task->toggle();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.tasks_complete_success'));
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class TasksController extends Controller
|
||||
|
||||
$contact->events()->forObject($task)->get()->each->delete();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.tasks_delete_success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use App\Note;
|
||||
use App\Tag;
|
||||
use Validator;
|
||||
use App\Contact;
|
||||
@@ -42,8 +41,8 @@ class PeopleController extends Controller
|
||||
}
|
||||
|
||||
$contacts = $user->account->contacts()->whereHas('tags', function ($query) use ($tag) {
|
||||
$query->where('id', $tag->id);
|
||||
})->sortedBy($sort)->get();
|
||||
$query->where('id', $tag->id);
|
||||
})->sortedBy($sort)->get();
|
||||
} else {
|
||||
$contacts = $user->account->contacts()->sortedBy($sort)->get();
|
||||
}
|
||||
@@ -87,7 +86,7 @@ class PeopleController extends Controller
|
||||
$contact->gender = $request->input('gender');
|
||||
$contact->first_name = ucfirst($request->input('first_name'));
|
||||
|
||||
if (!empty($request->input('last_name'))) {
|
||||
if (! empty($request->input('last_name'))) {
|
||||
$contact->last_name = ucfirst($request->input('last_name'));
|
||||
}
|
||||
|
||||
@@ -125,7 +124,6 @@ class PeopleController extends Controller
|
||||
*/
|
||||
public function edit(Contact $contact)
|
||||
{
|
||||
|
||||
return view('people.edit')
|
||||
->withContact($contact);
|
||||
}
|
||||
@@ -288,7 +286,7 @@ class PeopleController extends Controller
|
||||
$contact->save();
|
||||
}
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.information_edit_success'));
|
||||
}
|
||||
|
||||
@@ -331,7 +329,7 @@ class PeopleController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the work information
|
||||
* Save the work information.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Contact $contact
|
||||
@@ -349,7 +347,7 @@ class PeopleController extends Controller
|
||||
|
||||
$contact->save();
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.work_edit_success'));
|
||||
}
|
||||
|
||||
@@ -379,32 +377,33 @@ class PeopleController extends Controller
|
||||
|
||||
$contact->updateFoodPreferencies($food);
|
||||
|
||||
return redirect('/people/' . $contact->id)
|
||||
return redirect('/people/'.$contact->id)
|
||||
->with('success', trans('people.food_preferencies_add_success'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Search used in the header
|
||||
* Search used in the header.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function search(Request $request) {
|
||||
public function search(Request $request)
|
||||
{
|
||||
$needle = $request->needle;
|
||||
$accountId = $request->accountId;
|
||||
|
||||
if ($accountId != auth()->user()->account_id) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
if($needle == null) {
|
||||
return null;
|
||||
if ($needle == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($accountId == null) {
|
||||
return null;
|
||||
if ($accountId == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$results = Contact::search($needle, $accountId);
|
||||
if(sizeof($results) !== 0) {
|
||||
if (count($results) !== 0) {
|
||||
return $results;
|
||||
} else {
|
||||
return ['noResults' => trans('people.people_search_no_results')];
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Contact;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
@@ -61,7 +60,7 @@ class SubscriptionsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the downgrade process
|
||||
* Process the downgrade process.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
@@ -77,7 +76,7 @@ class SubscriptionsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the upgrade payment
|
||||
* Process the upgrade payment.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
@@ -96,7 +95,7 @@ class SubscriptionsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the invoice as PDF
|
||||
* Download the invoice as PDF.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use App\Tag;
|
||||
use App\User;
|
||||
use App\ImportJob;
|
||||
use Carbon\Carbon;
|
||||
use App\Invitation;
|
||||
use App\ImportJob;
|
||||
use App\Tag;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\RandomHelper;
|
||||
use App\Jobs\SendNewUserAlert;
|
||||
use App\Jobs\ExportAccountAsSQL;
|
||||
use App\Jobs\AddContactFromVCard;
|
||||
use App\Http\Requests\ImportsRequest;
|
||||
use App\Jobs\SendInvitationEmail;
|
||||
use App\Http\Requests\ImportsRequest;
|
||||
use App\Http\Requests\SettingsRequest;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Http\Requests\InvitationRequest;
|
||||
@@ -45,9 +45,9 @@ class SettingsController extends Controller
|
||||
'timezone',
|
||||
'locale',
|
||||
'currency_id',
|
||||
'name_order'
|
||||
'name_order',
|
||||
]) + [
|
||||
'fluid_container' => $request->get('layout')
|
||||
'fluid_container' => $request->get('layout'),
|
||||
]
|
||||
);
|
||||
|
||||
@@ -56,7 +56,7 @@ class SettingsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user account
|
||||
* Delete user account.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
@@ -66,7 +66,7 @@ class SettingsController extends Controller
|
||||
$user = $request->user();
|
||||
$account = $user->account;
|
||||
|
||||
if($account) {
|
||||
if ($account) {
|
||||
$account->reminders->each->forceDelete();
|
||||
$account->kids->each->forceDelete();
|
||||
$account->notes->each->forceDelete();
|
||||
@@ -89,7 +89,7 @@ class SettingsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset user account
|
||||
* Reset user account.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
@@ -99,7 +99,7 @@ class SettingsController extends Controller
|
||||
$user = $request->user();
|
||||
$account = $user->account;
|
||||
|
||||
if($account) {
|
||||
if ($account) {
|
||||
$account->reminders->each->forceDelete();
|
||||
$account->kids->each->forceDelete();
|
||||
$account->notes->each->forceDelete();
|
||||
@@ -119,7 +119,7 @@ class SettingsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the export view
|
||||
* Display the export view.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
@@ -129,7 +129,7 @@ class SettingsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the data of the account in SQL format
|
||||
* Exports the data of the account in SQL format.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
@@ -138,12 +138,12 @@ class SettingsController extends Controller
|
||||
$path = $this->dispatchNow(new ExportAccountAsSQL());
|
||||
|
||||
return response()
|
||||
->download(Storage::disk('public')->getDriver()->getAdapter()->getPathPrefix() . $path, 'monica.sql')
|
||||
->download(Storage::disk('public')->getDriver()->getAdapter()->getPathPrefix().$path, 'monica.sql')
|
||||
->deleteFileAfterSend(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the import view
|
||||
* Display the import view.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
@@ -173,7 +173,7 @@ class SettingsController extends Controller
|
||||
$importJob = auth()->user()->account->importjobs()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'type' => 'vcard',
|
||||
'filename' => $filename
|
||||
'filename' => $filename,
|
||||
]);
|
||||
|
||||
dispatch(new AddContactFromVCard($importJob));
|
||||
@@ -182,7 +182,7 @@ class SettingsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the import report view
|
||||
* Display the import report view.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
@@ -198,7 +198,7 @@ class SettingsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the users view
|
||||
* Display the users view.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
@@ -236,7 +236,7 @@ class SettingsController extends Controller
|
||||
public function inviteUser(InvitationRequest $request)
|
||||
{
|
||||
// Make sure the confirmation to invite has not been bypassed
|
||||
if(! $request->get('confirmation')) {
|
||||
if (! $request->get('confirmation')) {
|
||||
return redirect()->back()->withErrors(trans('settings.users_error_please_confirm'))->withInput();
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ class SettingsController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param String $key
|
||||
* @param string $key
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function acceptInvitation($key)
|
||||
@@ -309,7 +309,7 @@ class SettingsController extends Controller
|
||||
* Store the specified resource.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param String $key
|
||||
* @param string $key
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function storeAcceptedInvitation(Request $request, $key)
|
||||
@@ -344,7 +344,7 @@ class SettingsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete additional user account
|
||||
* Delete additional user account.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
@@ -370,7 +370,7 @@ class SettingsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the list of tags for this account
|
||||
* Display the list of tags for this account.
|
||||
*/
|
||||
public function tags()
|
||||
{
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Closure;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CheckLocale
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class ImportsRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'vcard' => 'required|max:10240|mimes:vcf,vcard'
|
||||
'vcard' => 'required|max:10240|mimes:vcf,vcard',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Requests\People;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ActivitiesRequest extends FormRequest
|
||||
{
|
||||
@@ -28,7 +27,7 @@ class ActivitiesRequest extends FormRequest
|
||||
'summary' => 'required',
|
||||
'date_it_happened' => 'required|date',
|
||||
'description' => 'string|nullable',
|
||||
'activity_type_id' => 'int|nullable'
|
||||
'activity_type_id' => 'int|nullable',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class CallsRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
'content' => '',
|
||||
'called_at' => 'date|nullable'
|
||||
'called_at' => 'date|nullable',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class GiftsRequest extends FormRequest
|
||||
'date_offered' => 'date|nullable',
|
||||
'value_in_dollars' => 'int|nullable',
|
||||
'has_recipient' => 'boolean',
|
||||
'recipient' => 'required_with:has_recipient'
|
||||
'recipient' => 'required_with:has_recipient',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class NotesRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'body' => 'required|string'
|
||||
'body' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class RemindersRequest extends FormRequest
|
||||
'next_expected_date' => 'required|date',
|
||||
'description' => 'string|nullable',
|
||||
'frequency_type' => 'required',
|
||||
'frequency_number' => 'int|nullable'
|
||||
'frequency_number' => 'int|nullable',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class SignificantOthersRequest extends FormRequest
|
||||
'status' => 'in:active,past|nullable',
|
||||
'is_birthdate_approximate' => 'required|in:unknown,approximate,exact',
|
||||
'birthdate' => 'date|nullable',
|
||||
'age' => 'int|nullable'
|
||||
'age' => 'int|nullable',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,13 @@
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use App\Country;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class CountrySelectViewComposer
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,7 +19,7 @@ class CountrySelectViewComposer
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$countries = Country::orderBy('country', 'asc')->get();
|
||||
$view->with('countries', $countries );
|
||||
$countries = Country::orderBy('country', 'asc')->get();
|
||||
$view->with('countries', $countries);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,13 @@
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use App\Currency;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class CurrencySelectViewComposer
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,7 +19,7 @@ class CurrencySelectViewComposer
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$currencies = Currency::orderBy('name', 'asc')->get();
|
||||
$view->with('currencies', $currencies );
|
||||
$currencies = Currency::orderBy('name', 'asc')->get();
|
||||
$view->with('currencies', $currencies);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +139,5 @@ Route::group(['middleware' => 'auth'], function () {
|
||||
Route::get('/settings/tags', 'SettingsController@tags')->name('.tags');
|
||||
Route::get('/settings/tags/add', 'SettingsController@addUser')->name('.tags.add');
|
||||
Route::get('/settings/tags/{user}/delete', ['as' => '.tags.delete', 'uses' => 'SettingsController@deleteTag']);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Instance extends Model
|
||||
{
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Auth;
|
||||
use App\Helpers\DateHelper;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
|
||||
@@ -4,17 +4,16 @@ namespace App\Jobs;
|
||||
|
||||
use App\User;
|
||||
use App\Contact;
|
||||
use App\Country;
|
||||
use App\Reminder;
|
||||
use App\ImportJob;
|
||||
use App\ImportJobReport;
|
||||
use App\Country;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Sabre\VObject\Component\VCard;
|
||||
use Sabre\VObject\Property\ICalendar\DateTime;
|
||||
use Sabre\VObject\Reader;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Sabre\VObject\Component\VCard;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
@@ -50,7 +49,6 @@ class AddContactFromVCard implements ShouldQueue
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
|
||||
$numberOfContactsInTheFile = preg_match_all('/(BEGIN:VCARD.*?END:VCARD)/s', Storage::disk('public')->get($this->importJob->filename), $matches);
|
||||
|
||||
$this->importJob->started_at = \Carbon\Carbon::now();
|
||||
@@ -58,7 +56,6 @@ class AddContactFromVCard implements ShouldQueue
|
||||
collect($matches[0])->map(function ($vcard) {
|
||||
return Reader::read($vcard);
|
||||
})->each(function (VCard $vcard) {
|
||||
|
||||
if ($this->contactExists($vcard, $this->importJob->account_id)) {
|
||||
$this->skippedContacts++;
|
||||
$this->fileImportJobReport($vcard, self::VCARD_SKIPPED, self::ERROR_CONTACT_EXIST);
|
||||
@@ -77,7 +74,7 @@ class AddContactFromVCard implements ShouldQueue
|
||||
$contact = new Contact();
|
||||
$contact->account_id = $this->importJob->account_id;
|
||||
|
||||
if($vcard->N && ! empty($vcard->N->getParts()[1])) {
|
||||
if ($vcard->N && ! empty($vcard->N->getParts()[1])) {
|
||||
$contact->first_name = $this->formatValue($vcard->N->getParts()[1]);
|
||||
$contact->middle_name = $this->formatValue($vcard->N->getParts()[2]);
|
||||
$contact->last_name = $this->formatValue($vcard->N->getParts()[0]);
|
||||
@@ -88,7 +85,7 @@ class AddContactFromVCard implements ShouldQueue
|
||||
$contact->gender = 'none';
|
||||
$contact->is_birthdate_approximate = 'unknown';
|
||||
|
||||
if ($vcard->BDAY && !empty((string) $vcard->BDAY)) {
|
||||
if ($vcard->BDAY && ! empty((string) $vcard->BDAY)) {
|
||||
$contact->is_birthdate_approximate = 'exact';
|
||||
$contact->birthdate = new \DateTime((string) $vcard->BDAY);
|
||||
}
|
||||
@@ -96,7 +93,7 @@ class AddContactFromVCard implements ShouldQueue
|
||||
$contact->email = $this->formatValue($vcard->EMAIL);
|
||||
$contact->phone_number = $this->formatValue($vcard->TEL);
|
||||
|
||||
if($vcard->ADR) {
|
||||
if ($vcard->ADR) {
|
||||
$contact->street = $this->formatValue($vcard->ADR->getParts()[2]);
|
||||
$contact->city = $this->formatValue($vcard->ADR->getParts()[3]);
|
||||
$contact->province = $this->formatValue($vcard->ADR->getParts()[4]);
|
||||
@@ -145,7 +142,6 @@ class AddContactFromVCard implements ShouldQueue
|
||||
$this->importJob->contacts_imported = $this->importedContacts;
|
||||
$this->importJob->ended_at = \Carbon\Carbon::now();
|
||||
$this->importJob->save();
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->importJob->contacts_found = $numberOfContactsInTheFile;
|
||||
$this->importJob->failed = 1;
|
||||
@@ -166,24 +162,24 @@ class AddContactFromVCard implements ShouldQueue
|
||||
* @param VCard $vcard
|
||||
* @return bool
|
||||
*/
|
||||
function contactHasName(VCard $vcard): bool
|
||||
public function contactHasName(VCard $vcard): bool
|
||||
{
|
||||
return ! empty($vcard->N->getParts()[1]) || ! empty((string) $vcard->NICKNAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats and returns a string for the contact
|
||||
* Formats and returns a string for the contact.
|
||||
*
|
||||
* @param null|string $value
|
||||
* @return null|string
|
||||
*/
|
||||
private function formatValue($value)
|
||||
{
|
||||
return !empty((string) $value) ? (string) $value : null;
|
||||
return ! empty((string) $value) ? (string) $value : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a contact already exists for a given account
|
||||
* Checks whether a contact already exists for a given account.
|
||||
*
|
||||
* @param VCard $vcard
|
||||
* @param User $user
|
||||
@@ -195,7 +191,7 @@ class AddContactFromVCard implements ShouldQueue
|
||||
|
||||
$contact = Contact::where([
|
||||
['account_id', $account_id],
|
||||
['email', $email]
|
||||
['email', $email],
|
||||
])->first();
|
||||
|
||||
return $email && $contact;
|
||||
@@ -204,9 +200,9 @@ class AddContactFromVCard implements ShouldQueue
|
||||
private function fileImportJobReport(VCard $vcard, $status, $reason = null)
|
||||
{
|
||||
$name = $this->formatValue($vcard->N->getParts()[1]);
|
||||
$name .= ' ' . $this->formatValue($vcard->N->getParts()[2]);
|
||||
$name .= ' ' . $this->formatValue($vcard->N->getParts()[0]);
|
||||
$name .= ' ' . $this->formatValue($vcard->EMAIL);
|
||||
$name .= ' '.$this->formatValue($vcard->N->getParts()[2]);
|
||||
$name .= ' '.$this->formatValue($vcard->N->getParts()[0]);
|
||||
$name .= ' '.$this->formatValue($vcard->EMAIL);
|
||||
|
||||
$importJobReport = new ImportJobReport;
|
||||
$importJobReport->account_id = $this->importJob->account_id;
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace App\Jobs;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class ExportAccountAsSQL
|
||||
{
|
||||
@@ -28,14 +28,14 @@ class ExportAccountAsSQL
|
||||
'subscriptions',
|
||||
'import_jobs',
|
||||
'import_job_reports',
|
||||
'instances'
|
||||
'instances',
|
||||
];
|
||||
|
||||
protected $ignoredColumns = [
|
||||
'stripe_id',
|
||||
'card_brand',
|
||||
'card_last_four',
|
||||
'trial_ends_at'
|
||||
'trial_ends_at',
|
||||
];
|
||||
|
||||
protected $file = '';
|
||||
@@ -50,7 +50,7 @@ class ExportAccountAsSQL
|
||||
public function __construct($file = null, $path = null)
|
||||
{
|
||||
$this->path = $path ?? 'exports/';
|
||||
$this->file = rand() . '.sql';
|
||||
$this->file = rand().'.sql';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,18 +60,18 @@ class ExportAccountAsSQL
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$downloadPath = $this->path . $this->file;
|
||||
$downloadPath = $this->path.$this->file;
|
||||
|
||||
$user = auth()->user();
|
||||
$account = $user->account;
|
||||
|
||||
$sql = "# ************************************************************
|
||||
# " . $user->first_name . " " . $user->last_name . " dump of data
|
||||
$sql = '# ************************************************************
|
||||
# '.$user->first_name.' '.$user->last_name." dump of data
|
||||
# {$this->file}
|
||||
# Export date: " . Carbon::now() . "
|
||||
# Export date: ".Carbon::now().'
|
||||
# ************************************************************
|
||||
|
||||
" . PHP_EOL;
|
||||
'.PHP_EOL;
|
||||
|
||||
$tables = DB::select('SELECT table_name FROM information_schema.tables WHERE table_schema="monica"');
|
||||
|
||||
@@ -87,8 +87,7 @@ class ExportAccountAsSQL
|
||||
|
||||
// Looping over the rows
|
||||
foreach ($tableData as $data) {
|
||||
|
||||
$newSQLLine = 'INSERT INTO ' . $tableName . ' (';
|
||||
$newSQLLine = 'INSERT INTO '.$tableName.' (';
|
||||
$tableValues = [];
|
||||
$skipLine = false;
|
||||
|
||||
@@ -98,11 +97,10 @@ class ExportAccountAsSQL
|
||||
array_push($tableColumnNames, $columnName);
|
||||
}
|
||||
|
||||
$newSQLLine .= implode(',', $tableColumnNames) . ') VALUES (';
|
||||
$newSQLLine .= implode(',', $tableColumnNames).') VALUES (';
|
||||
|
||||
// Looping over the values
|
||||
foreach ($data as $columnName => $value) {
|
||||
|
||||
if ($columnName == 'account_id') {
|
||||
if ($value !== $account->id) {
|
||||
$skipLine = true;
|
||||
@@ -112,15 +110,15 @@ class ExportAccountAsSQL
|
||||
|
||||
if (is_null($value)) {
|
||||
$value = 'NULL';
|
||||
} elseif (!is_numeric($value)) {
|
||||
$value = "'" . addslashes($value) . "'";
|
||||
} elseif (! is_numeric($value)) {
|
||||
$value = "'".addslashes($value)."'";
|
||||
}
|
||||
|
||||
array_push($tableValues, $value);
|
||||
}
|
||||
|
||||
if ($skipLine == false) {
|
||||
$newSQLLine .= implode(',', $tableValues) . ');' . PHP_EOL;
|
||||
$newSQLLine .= implode(',', $tableValues).');'.PHP_EOL;
|
||||
$sql .= $newSQLLine;
|
||||
}
|
||||
}
|
||||
@@ -128,24 +126,24 @@ class ExportAccountAsSQL
|
||||
|
||||
// Specific to `accounts` table
|
||||
$accounts = array_filter($tables, function ($e) {
|
||||
return $e->table_name == 'accounts';
|
||||
}
|
||||
return $e->table_name == 'accounts';
|
||||
}
|
||||
)[0];
|
||||
$tableName = $accounts->table_name;
|
||||
$tableData = DB::table($tableName)->get()->toArray();
|
||||
foreach ($tableData as $data) {
|
||||
$newSQLLine = 'INSERT INTO ' . $tableName . ' VALUES (';
|
||||
$newSQLLine = 'INSERT INTO '.$tableName.' VALUES (';
|
||||
$data = (array) $data;
|
||||
if($data['id'] === $account->id):
|
||||
if ($data['id'] === $account->id):
|
||||
$values = [
|
||||
$data['id'],
|
||||
"'".addslashes($data['api_key'])."'",
|
||||
$data['number_of_invitations_sent'] !== NULL
|
||||
$data['number_of_invitations_sent'] !== null
|
||||
? $data['number_of_invitations_sent']
|
||||
: 'NULL',
|
||||
];
|
||||
$newSQLLine .= implode(',', $values) . ');' . PHP_EOL;
|
||||
$sql .= $newSQLLine;
|
||||
$newSQLLine .= implode(',', $values).');'.PHP_EOL;
|
||||
$sql .= $newSQLLine;
|
||||
endif;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ class ResizeAvatars implements ShouldQueue
|
||||
public function handle()
|
||||
{
|
||||
if ($this->contact->has_avatar == 'true') {
|
||||
|
||||
$avatar_file = Storage::disk('public')->get($this->contact->avatar_file_name);
|
||||
$avatar_path = Storage::disk('public')->url($this->contact->avatar_file_name);
|
||||
$avatar_filename_without_extension = pathinfo($avatar_path, PATHINFO_FILENAME);
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace App\Jobs;
|
||||
|
||||
use App\User;
|
||||
use App\Reminder;
|
||||
use Carbon\Carbon;
|
||||
use App\Mail\UserReminded;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Log;
|
||||
use App\Reminder;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
+4
-7
@@ -2,10 +2,7 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\Gift;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use App\Helpers\DateHelper;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
@@ -83,7 +80,7 @@ class Kid extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date_it_happened field according to user's timezone
|
||||
* Get the date_it_happened field according to user's timezone.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
@@ -98,7 +95,7 @@ class Kid extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get age according to the birthdate
|
||||
* Get age according to the birthdate.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -126,7 +123,7 @@ class Kid extends Model
|
||||
public function getBirthdate()
|
||||
{
|
||||
if (is_null($this->birthdate)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->birthdate;
|
||||
@@ -139,7 +136,7 @@ class Kid extends Model
|
||||
public function getFirstName()
|
||||
{
|
||||
if (is_null($this->first_name)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->first_name;
|
||||
|
||||
@@ -6,7 +6,6 @@ use App\Invitation;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class InvitationSent extends Mailable
|
||||
{
|
||||
|
||||
@@ -6,7 +6,6 @@ use App\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class NewUserAlert extends Mailable
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@ use App\Reminder;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class UserReminded extends Mailable
|
||||
{
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Parsedown;
|
||||
use App\Helpers\DateHelper;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Parsedown;
|
||||
|
||||
/**
|
||||
* @property Account $account
|
||||
@@ -42,7 +42,7 @@ class Note extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the markdown parsed body
|
||||
* Return the markdown parsed body.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Laravel\Dusk\DuskServiceProvider;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
@@ -15,12 +15,12 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
View::composer(
|
||||
'partials.components.country-select','App\Http\ViewComposers\CountrySelectViewComposer'
|
||||
View::composer(
|
||||
'partials.components.country-select', 'App\Http\ViewComposers\CountrySelectViewComposer'
|
||||
);
|
||||
|
||||
View::composer(
|
||||
'partials.components.currency-select','App\Http\ViewComposers\CurrencySelectViewComposer'
|
||||
View::composer(
|
||||
'partials.components.currency-select', 'App\Http\ViewComposers\CurrencySelectViewComposer'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Activity;
|
||||
use Route;
|
||||
use App\Kid;
|
||||
use App\Debt;
|
||||
use App\Gift;
|
||||
use App\Kid;
|
||||
use App\Note;
|
||||
use App\Task;
|
||||
use App\Contact;
|
||||
use App\Activity;
|
||||
use App\Reminder;
|
||||
use App\SignificantOther;
|
||||
use App\Task;
|
||||
use Route;
|
||||
use App\Contact;
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
@@ -41,56 +41,56 @@ class RouteServiceProvider extends ServiceProvider
|
||||
->firstOrFail();
|
||||
});
|
||||
|
||||
Route::bind('activity', function($value, $route) {
|
||||
Route::bind('activity', function ($value, $route) {
|
||||
return Activity::where('account_id', auth()->user()->account_id)
|
||||
->where('contact_id', $route->parameter('contact')->id)
|
||||
->where('id', $value)
|
||||
->firstOrFail();
|
||||
});
|
||||
|
||||
Route::bind('reminder', function($value, $route) {
|
||||
Route::bind('reminder', function ($value, $route) {
|
||||
return Reminder::where('account_id', auth()->user()->account_id)
|
||||
->where('contact_id', $route->parameter('contact')->id)
|
||||
->where('id', $value)
|
||||
->firstOrFail();
|
||||
});
|
||||
|
||||
Route::bind('task', function($value, $route) {
|
||||
Route::bind('task', function ($value, $route) {
|
||||
return Task::where('account_id', auth()->user()->account_id)
|
||||
->where('contact_id', $route->parameter('contact')->id)
|
||||
->where('id', $value)
|
||||
->firstOrFail();
|
||||
});
|
||||
|
||||
Route::bind('gift', function($value, $route) {
|
||||
Route::bind('gift', function ($value, $route) {
|
||||
return Gift::where('account_id', auth()->user()->account_id)
|
||||
->where('contact_id', $route->parameter('contact')->id)
|
||||
->where('id', $value)
|
||||
->firstOrFail();
|
||||
});
|
||||
|
||||
Route::bind('debt', function($value, $route) {
|
||||
Route::bind('debt', function ($value, $route) {
|
||||
return Debt::where('account_id', auth()->user()->account_id)
|
||||
->where('contact_id', $route->parameter('contact')->id)
|
||||
->where('id', $value)
|
||||
->firstOrFail();
|
||||
});
|
||||
|
||||
Route::bind('significant_other', function($value, $route) {
|
||||
Route::bind('significant_other', function ($value, $route) {
|
||||
return SignificantOther::where('account_id', auth()->user()->account_id)
|
||||
->where('contact_id', $route->parameter('contact')->id)
|
||||
->where('id', $value)
|
||||
->firstOrFail();
|
||||
});
|
||||
|
||||
Route::bind('kid', function($value, $route) {
|
||||
Route::bind('kid', function ($value, $route) {
|
||||
return Kid::where('account_id', auth()->user()->account_id)
|
||||
->where('child_of_contact_id', $route->parameter('contact')->id)
|
||||
->where('id', $value)
|
||||
->firstOrFail();
|
||||
});
|
||||
|
||||
Route::bind('note', function($value, $route) {
|
||||
Route::bind('note', function ($value, $route) {
|
||||
return Note::where('account_id', auth()->user()->account_id)
|
||||
->where('contact_id', $route->parameter('contact')->id)
|
||||
->where('id', $value)
|
||||
|
||||
+6
-8
@@ -2,13 +2,11 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Log;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use App\Helpers\DateHelper;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use MartinJoiner\OrdinalNumber\OrdinalNumber;
|
||||
|
||||
/**
|
||||
* @property Account $account
|
||||
@@ -51,7 +49,7 @@ class Reminder extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next_expected_date field according to user's timezone
|
||||
* Get the next_expected_date field according to user's timezone.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
@@ -66,7 +64,7 @@ class Reminder extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Correctly set the frequency type
|
||||
* Correctly set the frequency type.
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
@@ -76,7 +74,7 @@ class Reminder extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new birthday reminder
|
||||
* Add a new birthday reminder.
|
||||
*
|
||||
* @param Contact $contact
|
||||
* @param string $title
|
||||
@@ -98,7 +96,7 @@ class Reminder extends Model
|
||||
'account_id' => $contact->account_id,
|
||||
'is_birthday' => 'true',
|
||||
'about_object' => $kid ? 'kid' : ($significantOther ? 'significantother' : 'contact'),
|
||||
'about_object_id' => $kid ? $kid->id : ($significantOther ? $significantOther->id : $contact->id)
|
||||
'about_object_id' => $kid ? $kid->id : ($significantOther ? $significantOther->id : $contact->id),
|
||||
]);
|
||||
|
||||
$account = $reminder->contact->account;
|
||||
@@ -118,7 +116,7 @@ class Reminder extends Model
|
||||
public function getTitle()
|
||||
{
|
||||
if (is_null($this->title)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->title;
|
||||
@@ -131,7 +129,7 @@ class Reminder extends Model
|
||||
public function getDescription()
|
||||
{
|
||||
if (is_null($this->description)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->description;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ class SignificantOther extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit the query to active significant others
|
||||
* Limit the query to active significant others.
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
@@ -102,7 +102,7 @@ class SignificantOther extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date_it_happened field according to user's timezone
|
||||
* Get the date_it_happened field according to user's timezone.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
@@ -117,7 +117,7 @@ class SignificantOther extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get age according to the birthdate
|
||||
* Get age according to the birthdate.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -134,7 +134,7 @@ class SignificantOther extends Model
|
||||
public function getName()
|
||||
{
|
||||
if ($this->first_name == '') {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->first_name;
|
||||
@@ -148,7 +148,7 @@ class SignificantOther extends Model
|
||||
public function getBirthdate()
|
||||
{
|
||||
if (is_null($this->birthdate)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->birthdate;
|
||||
@@ -166,7 +166,7 @@ class SignificantOther extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns 'true' if the birthdate is an approximation
|
||||
* Returns 'true' if the birthdate is an approximation.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Statistic extends Model
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class Tag extends Model
|
||||
{
|
||||
|
||||
+4
-7
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Auth;
|
||||
use App\Helpers\DateHelper;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
@@ -16,7 +14,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
*/
|
||||
class Task extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
*
|
||||
@@ -52,7 +49,7 @@ class Task extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit tasks to completed ones
|
||||
* Limit tasks to completed ones.
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
@@ -63,7 +60,7 @@ class Task extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit tasks to in-progress ones
|
||||
* Limit tasks to in-progress ones.
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
@@ -74,7 +71,7 @@ class Task extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle task status
|
||||
* Toggle task status.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,7 @@ trait Searchable
|
||||
public function scopeSearch(Builder $builder, $needle, $accountId)
|
||||
{
|
||||
if ($this->searchable_columns == null) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
// building the query. there is probably a way to make this more elegant.
|
||||
@@ -26,15 +26,15 @@ trait Searchable
|
||||
$queryString = '';
|
||||
foreach ($this->searchable_columns as $column) {
|
||||
$queryString .= $column.' LIKE \'%'.$needle.'%\'';
|
||||
if ($counter != $count) {
|
||||
if ($counter != $count) {
|
||||
$queryString .= ' or ';
|
||||
}
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
|
||||
$builder->whereRaw('account_id = '.$accountId.' and ('. $queryString .')');
|
||||
$builder->whereRaw('account_id = '.$accountId.' and ('.$queryString.')');
|
||||
$builder->select($this->return_from_search);
|
||||
|
||||
return $builder->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -16,7 +16,7 @@ class User extends Authenticatable
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password', 'timezone', 'locale', 'currency_id', 'fluid_container', 'name_order'
|
||||
'name', 'email', 'password', 'timezone', 'locale', 'currency_id', 'fluid_container', 'name_order',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ class User extends Authenticatable
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns a default value just in case the sort order is empty
|
||||
* Assigns a default value just in case the sort order is empty.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
@@ -92,15 +92,15 @@ class User extends Authenticatable
|
||||
if ($this->name_order == 'firstname_first') {
|
||||
$completeName = $this->first_name;
|
||||
|
||||
if (!is_null($this->last_name)) {
|
||||
$completeName = $completeName . ' ' . $this->last_name;
|
||||
if (! is_null($this->last_name)) {
|
||||
$completeName = $completeName.' '.$this->last_name;
|
||||
}
|
||||
} else {
|
||||
if (!is_null($this->last_name)) {
|
||||
if (! is_null($this->last_name)) {
|
||||
$completeName = $this->last_name;
|
||||
}
|
||||
|
||||
$completeName = $completeName . ' ' . $this->first_name;
|
||||
$completeName = $completeName.' '.$this->first_name;
|
||||
}
|
||||
|
||||
return $completeName;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Helpers\MoneyHelper;
|
||||
|
||||
return [
|
||||
|
||||
+6
-8
@@ -131,27 +131,25 @@ $db = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
/*
|
||||
* If the instance is hosted on Heroku, then the database information
|
||||
* needs to be parsed from the environment variable provided by Heroku.
|
||||
* This is done below, added to the $db variable and then returned.
|
||||
*/
|
||||
if( env('HEROKU') )
|
||||
{
|
||||
$url = parse_url(env("CLEARDB_DATABASE_URL"));
|
||||
if (env('HEROKU')) {
|
||||
$url = parse_url(env('CLEARDB_DATABASE_URL'));
|
||||
|
||||
$db['connections']['heroku'] = [
|
||||
'driver' => 'mysql',
|
||||
'host' => $url['host'],
|
||||
'port' => $url['port'],
|
||||
'database' => substr($url["path"], 1),
|
||||
'username' => $url["user"],
|
||||
'password' => $url["pass"],
|
||||
'database' => substr($url['path'], 1),
|
||||
'username' => $url['user'],
|
||||
'password' => $url['pass'],
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'schema' => 'public',
|
||||
];
|
||||
}
|
||||
|
||||
return $db;
|
||||
return $db;
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -15,6 +15,6 @@ return array(
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'gd'
|
||||
'driver' => 'gd',
|
||||
|
||||
);
|
||||
];
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ return [
|
||||
'fr',
|
||||
'pt-br',
|
||||
'ru',
|
||||
'cz'
|
||||
'cz',
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
@@ -22,13 +22,13 @@ $factory->define(App\User::class, function (Faker\Generator $faker) {
|
||||
'remember_token' => str_random(10),
|
||||
'timezone' => config('app.timezone'),
|
||||
'name_order' => 'firstname_first',
|
||||
'account_id' => factory('App\Account')->create()->id
|
||||
'account_id' => factory('App\Account')->create()->id,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Account::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'api_key' => RandomHelper::generateString(30)
|
||||
'api_key' => RandomHelper::generateString(30),
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateKidsTable extends Migration
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateRelationsTable extends Migration
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateActivityTypeTable extends Migration
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddIconColumn extends Migration
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveTypeFromNotes extends Migration
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeTitleColumn extends Migration
|
||||
|
||||
@@ -9,7 +9,6 @@ use App\Activity;
|
||||
use App\Reminder;
|
||||
use App\SignificantOther;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ use App\Activity;
|
||||
use App\Reminder;
|
||||
use App\SignificantOther;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
|
||||
@@ -7,9 +7,6 @@ use App\Task;
|
||||
use App\Contact;
|
||||
use App\Activity;
|
||||
use App\Reminder;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CalculateStatistics extends Migration
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\SignificantOther;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixSignificantOtherField extends Migration
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Kid;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MigrateKidsTable extends Migration
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Contact;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveContactEncryption extends Migration
|
||||
@@ -17,27 +15,27 @@ class RemoveContactEncryption extends Migration
|
||||
$contacts = Contact::all();
|
||||
foreach ($contacts as $contact) {
|
||||
echo $contact->id;
|
||||
if (!is_null ($contact->email)) {
|
||||
if (! is_null($contact->email)) {
|
||||
$contact->email = decrypt($contact->email);
|
||||
}
|
||||
|
||||
if (!is_null ($contact->phone_number)) {
|
||||
if (! is_null($contact->phone_number)) {
|
||||
$contact->phone_number = decrypt($contact->phone_number);
|
||||
}
|
||||
|
||||
if (!is_null ($contact->street)) {
|
||||
if (! is_null($contact->street)) {
|
||||
$contact->street = decrypt($contact->street);
|
||||
}
|
||||
|
||||
if (!is_null ($contact->city)) {
|
||||
if (! is_null($contact->city)) {
|
||||
$contact->city = decrypt($contact->city);
|
||||
}
|
||||
|
||||
if (!is_null ($contact->province)) {
|
||||
if (! is_null($contact->province)) {
|
||||
$contact->province = decrypt($contact->province);
|
||||
}
|
||||
|
||||
if (!is_null ($contact->postal_code)) {
|
||||
if (! is_null($contact->postal_code)) {
|
||||
$contact->postal_code = decrypt($contact->postal_code);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class AlterActivityNullable extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('activities', function(Blueprint $table) {
|
||||
Schema::table('activities', function (Blueprint $table) {
|
||||
$table->integer('activity_type_id')->unsigned()->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Task;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveEncryptionTasks extends Migration
|
||||
@@ -17,15 +15,15 @@ class RemoveEncryptionTasks extends Migration
|
||||
$tasks = Task::all();
|
||||
foreach ($tasks as $task) {
|
||||
echo $task->id.' ';
|
||||
if (!is_null ($task->title)) {
|
||||
if (! is_null($task->title)) {
|
||||
$task->title = decrypt($task->title);
|
||||
}
|
||||
|
||||
if (!is_null ($task->description)) {
|
||||
if (! is_null($task->description)) {
|
||||
$task->description = decrypt($task->description);
|
||||
}
|
||||
|
||||
$task->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ class RemovePredefinedReminders extends Migration
|
||||
$reminders = Reminder::all();
|
||||
foreach ($reminders as $reminder) {
|
||||
echo $reminder->id.' ';
|
||||
if (!is_null ($reminder->title)) {
|
||||
if (! is_null($reminder->title)) {
|
||||
$reminder->title = decrypt($reminder->title);
|
||||
}
|
||||
|
||||
if (!is_null ($reminder->description)) {
|
||||
if (! is_null($reminder->description)) {
|
||||
$reminder->description = decrypt($reminder->description);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateMoneyTable extends Migration
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddMultipleGendersChoices extends Migration
|
||||
@@ -14,8 +12,7 @@ class AddMultipleGendersChoices extends Migration
|
||||
public function up()
|
||||
{
|
||||
$driverName = DB::connection()->getPDO()->getAttribute(PDO::ATTR_DRIVER_NAME);
|
||||
switch($driverName)
|
||||
{
|
||||
switch ($driverName) {
|
||||
case 'mysql':
|
||||
DB::statement("ALTER TABLE contacts CHANGE COLUMN gender gender ENUM('male', 'female', 'none')");
|
||||
DB::statement("ALTER TABLE significant_others CHANGE COLUMN gender gender ENUM('male', 'female', 'none')");
|
||||
@@ -33,18 +30,19 @@ class AddMultipleGendersChoices extends Migration
|
||||
}
|
||||
|
||||
/**
|
||||
* Alter an enum field constraints. Source: https://stackoverflow.com/a/36198549
|
||||
* Alter an enum field constraints. Source: https://stackoverflow.com/a/36198549.
|
||||
* @param $table
|
||||
* @param $field
|
||||
* @param array $options
|
||||
*/
|
||||
protected function alterEnum($table, $field, array $options) {
|
||||
protected function alterEnum($table, $field, array $options)
|
||||
{
|
||||
$check = "${table}_${field}_check";
|
||||
$enumList = [];
|
||||
foreach($options as $option) {
|
||||
foreach ($options as $option) {
|
||||
$enumList[] = sprintf("'%s'::CHARACTER VARYING", $option);
|
||||
}
|
||||
$enumString = implode(", ", $enumList);
|
||||
$enumString = implode(', ', $enumList);
|
||||
DB::transaction(function () use ($table, $field, $check, $options, $enumString) {
|
||||
DB::statement(sprintf('ALTER TABLE %s DROP CONSTRAINT %s;', $table, $check));
|
||||
DB::statement(sprintf('ALTER TABLE %s ADD CONSTRAINT %s CHECK (%s::TEXT = ANY (ARRAY[%s]::TEXT[]))', $table, $check, $field, $enumString));
|
||||
|
||||
@@ -13,26 +13,25 @@ class CreateCurrenciesData extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('currencies', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('iso');
|
||||
$table->string('name');
|
||||
$table->string('symbol');
|
||||
});
|
||||
Schema::create('currencies', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('iso');
|
||||
$table->string('name');
|
||||
$table->string('symbol');
|
||||
});
|
||||
|
||||
//defaults
|
||||
DB::table('currencies')->insert([ 'iso' => 'CAD', 'name' => 'Canadian Dollar', 'symbol'=>'$' ]);
|
||||
DB::table('currencies')->insert([ 'iso' => 'USD', 'name' => 'US Dollar', 'symbol'=>'$' ]);
|
||||
DB::table('currencies')->insert([ 'iso' => 'GBP', 'name' => 'British Pound', 'symbol'=>'£' ]);
|
||||
DB::table('currencies')->insert([ 'iso' => 'EUR', 'name' => 'Euro', 'symbol'=>'€' ]);
|
||||
DB::table('currencies')->insert([ 'iso' => 'RUB', 'name' => 'Russian Ruble', 'symbol'=>'₽' ]);
|
||||
DB::table('currencies')->insert(['iso' => 'CAD', 'name' => 'Canadian Dollar', 'symbol'=>'$']);
|
||||
DB::table('currencies')->insert(['iso' => 'USD', 'name' => 'US Dollar', 'symbol'=>'$']);
|
||||
DB::table('currencies')->insert(['iso' => 'GBP', 'name' => 'British Pound', 'symbol'=>'£']);
|
||||
DB::table('currencies')->insert(['iso' => 'EUR', 'name' => 'Euro', 'symbol'=>'€']);
|
||||
DB::table('currencies')->insert(['iso' => 'RUB', 'name' => 'Russian Ruble', 'symbol'=>'₽']);
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$dollarResult = DB::table('currencies')->select('id')->where('iso','=','USD')->value('id');
|
||||
$table->integer('currency_id')->after('timezone')->default(
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$dollarResult = DB::table('currencies')->select('id')->where('iso', '=', 'USD')->value('id');
|
||||
$table->integer('currency_id')->after('timezone')->default(
|
||||
$dollarResult
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Entry;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveEncryptionJournal extends Migration
|
||||
@@ -17,11 +15,11 @@ class RemoveEncryptionJournal extends Migration
|
||||
$entries = Entry::all();
|
||||
foreach ($entries as $entry) {
|
||||
echo $entry->id.' ';
|
||||
if (!is_null ($entry->title)) {
|
||||
if (! is_null($entry->title)) {
|
||||
$entry->title = decrypt($entry->title);
|
||||
}
|
||||
|
||||
if (!is_null ($entry->post)) {
|
||||
if (! is_null($entry->post)) {
|
||||
$entry->post = decrypt($entry->post);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Gift;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveGiftsEncryption extends Migration
|
||||
@@ -19,15 +17,15 @@ class RemoveGiftsEncryption extends Migration
|
||||
|
||||
// Uncomment the line below if you need to debug which row poses problem
|
||||
//echo $gift->id;
|
||||
if (!is_null ($gift->name)) {
|
||||
if (! is_null($gift->name)) {
|
||||
$gift->name = decrypt($gift->name);
|
||||
}
|
||||
|
||||
if (!is_null ($gift->comment)) {
|
||||
if (! is_null($gift->comment)) {
|
||||
$gift->comment = decrypt($gift->comment);
|
||||
}
|
||||
|
||||
if (!is_null ($gift->url)) {
|
||||
if (! is_null($gift->url)) {
|
||||
$gift->url = decrypt($gift->url);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveBernTimezone extends Migration
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user