mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
24 lines
648 B
PHP
24 lines
648 B
PHP
<?php namespace app\Models;
|
|
|
|
use Eloquent;
|
|
use Auth;
|
|
|
|
class InvoiceDesign extends Eloquent
|
|
{
|
|
public $timestamps = false;
|
|
|
|
public function scopeAvailableDesigns($query)
|
|
{
|
|
$designs = $query->where('id', '<=', \Auth::user()->maxInvoiceDesignId())->orderBy('id')->get();
|
|
|
|
foreach ($designs as $design) {
|
|
$fileName = public_path(strtolower("js/templates/{$design->name}.js"));
|
|
if (Auth::user()->account->utf8_invoices && file_exists($fileName)) {
|
|
$design->javascript = file_get_contents($fileName);
|
|
}
|
|
}
|
|
|
|
return $designs;
|
|
}
|
|
}
|