Code cleanup.

This commit is contained in:
James Cole
2015-07-26 15:51:07 +02:00
parent 0e2419d61a
commit 17a8c4918c
30 changed files with 176 additions and 172 deletions

View File

@@ -124,7 +124,7 @@ class AttachmentController extends Controller
*/
public function preview(Attachment $attachment)
{
if($attachment->mime == 'application/pdf') {
if ($attachment->mime == 'application/pdf') {
$file = public_path('images/page_white_acrobat.png');
} else {
$file = public_path('images/page_green.png');

View File

@@ -6,7 +6,6 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Preferences;
use Session;
use View;
/**

View File

@@ -1,5 +1,6 @@
<?php namespace FireflyIII\Http\Controllers;
use Artisan;
use Auth;
use Carbon\Carbon;
use Config;
@@ -11,7 +12,7 @@ use Preferences;
use Route;
use Session;
use Steam;
use Artisan;
/**
* Class HomeController
*

View File

@@ -193,7 +193,6 @@ Route::group(
Route::post('/accounts/destroy/{account}', ['uses' => 'AccountController@destroy', 'as' => 'accounts.destroy']);
/**
* Attachment Controller
*/

View File

@@ -38,7 +38,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereRemindMe($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminderSkip($value)
* @property-read \FireflyIII\Models\PiggyBankRepetition $currentRep
* @property string $reminder
* @property string $reminder
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminder($value)
*/
class PiggyBank extends Model

View File

@@ -68,7 +68,7 @@ use Watson\Validating\ValidatingTrait;
* @property-read int $account_id
* @property-read string $name
* @property-read string $symbol
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
*/
class TransactionJournal extends Model
{

View File

@@ -12,6 +12,21 @@ use FireflyIII\Models\Attachment;
class AttachmentRepository implements AttachmentRepositoryInterface
{
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment)
{
/** @var \FireflyIII\Helpers\Attachments\AttachmentHelperInterface $helper */
$helper = app('FireflyIII\Helpers\Attachments\AttachmentHelperInterface');
$file = $helper->getAttachmentLocation($attachment);
unlink($file);
$attachment->delete();
}
/**
* @param Attachment $attachment
* @param array $data
@@ -29,19 +44,4 @@ class AttachmentRepository implements AttachmentRepositoryInterface
return $attachment;
}
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment)
{
/** @var \FireflyIII\Helpers\Attachments\AttachmentHelperInterface $helper */
$helper = app('FireflyIII\Helpers\Attachments\AttachmentHelperInterface');
$file = $helper->getAttachmentLocation($attachment);
unlink($file);
$attachment->delete();
}
}

View File

@@ -12,6 +12,13 @@ use FireflyIII\Models\Attachment;
interface AttachmentRepositoryInterface
{
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment);
/**
* @param Attachment $attachment
* @param array $attachmentData
@@ -19,12 +26,5 @@ interface AttachmentRepositoryInterface
* @return Attachment
*/
public function update(Attachment $attachment, array $attachmentData);
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment);
}

View File

@@ -96,7 +96,7 @@ class Steam
*
* @return int
*/
public function phpBytes($string)
public function phpBytes($string)
{
$string = strtolower($string);

View File

@@ -33,10 +33,10 @@ use Zizaco\Entrust\Traits\EntrustUserTrait;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User wherePassword($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereReset($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereRememberToken($value)
* @property boolean $blocked
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @property boolean $blocked
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereBlocked($value)
* @property string $blocked_code
* @property string $blocked_code
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereBlockedCode($value)
*/
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
@@ -49,7 +49,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
*
* @var array
*/
protected $fillable = ['email', 'password','blocked','blocked_code'];
protected $fillable = ['email', 'password', 'blocked', 'blocked_code'];
/**
* The attributes excluded from the model's JSON form.
*