1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/models/Product.php

24 lines
475 B
PHP
Raw Normal View History

2013-11-26 13:45:07 +01:00
<?php
class Product extends Eloquent
{
protected $softDelete = true;
public static function getProducts()
{
return Product::where('account_id','=',Auth::user()->account_id);
}
public static function findProduct($key)
{
2013-11-28 17:40:13 +01:00
return Product::getProducts()->where('key','=',$key)->first();
}
public static function getProductKeys($products)
{
2013-11-28 17:40:13 +01:00
$products = array_pluck($products, 'key');
$products = array_combine($products, $products);
return $products;
}
2013-11-26 13:45:07 +01:00
}