1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/models/Product.php
2013-12-03 19:32:33 +02:00

24 lines
463 B
PHP
Executable File

<?php
class Product extends Eloquent
{
protected $softDelete = true;
public function scopeScope($query)
{
return $query->whereAccountId(Auth::user()->account_id);
}
public static function findProductByKey($key)
{
return Product::scope()->where('key','=',$key)->first();
}
public static function getProductKeys($products)
{
$products = array_pluck($products, 'key');
$products = array_combine($products, $products);
return $products;
}
}