Fixes
This commit is contained in:
@@ -12,7 +12,7 @@ class VarietiesDataTable extends DataTable
|
||||
|
||||
public function query(Variety $model)
|
||||
{
|
||||
$model = $model::with('specie')->select(['botanic_varieties.*']);
|
||||
$model = $model::with('specie')->select('botanic_varieties.*');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,10 +87,7 @@ class ParentDataTable extends DataTable
|
||||
->minifiedAjax()
|
||||
->dom($this->getDom())
|
||||
->orderBy(0,'asc')
|
||||
->buttons(
|
||||
Button::make('export'),
|
||||
Button::make('print')
|
||||
);
|
||||
->buttons($this->getDatatablesButtons());
|
||||
}
|
||||
|
||||
public function getParameters()
|
||||
@@ -98,6 +95,14 @@ class ParentDataTable extends DataTable
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getDatatablesButtons()
|
||||
{
|
||||
$buttons = [];
|
||||
$buttons[] = Button::make('export');
|
||||
$buttons[] = Button::make('print');
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
public function getDom()
|
||||
{
|
||||
$dom = $this->getDatatablesHeaderDefault();
|
||||
|
||||
@@ -12,15 +12,35 @@ class ArticlesDataTable extends DataTable
|
||||
|
||||
public function query(Article $model)
|
||||
{
|
||||
// $model = $model::with('Family')->select('shop_articles.*','family.name as family_name')->join('shop_article_families as family', 'family.id', '=', 'shop_articles.article_family_id')->groupBy('shop_articles.id');
|
||||
$model = $model::with('Family')->select('shop_articles.*');
|
||||
// $model = $model::joinRelations('Family')->select('shop_articles.*','shop_article_families.name as family_name');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
/*
|
||||
$columns = [];
|
||||
$columns[] = [
|
||||
'name' => 'family',
|
||||
'data' => 'family.name',
|
||||
'title' => 'Famille',
|
||||
'orderable' => false
|
||||
];
|
||||
$columns[] = [
|
||||
'name' => 'name',
|
||||
'title' => 'Nom',
|
||||
];
|
||||
$columns[] = self::makeColumnButtons();
|
||||
return $columns;
|
||||
*/
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::make('family.name')->title('Famille')->orderable(false),
|
||||
Column::make('name')->title('Nom'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class InvoicesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Invoices';
|
||||
|
||||
public function query(Product $model)
|
||||
public function query(Invoice $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -7,19 +7,21 @@ use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
||||
use Rinvex\Categories\Traits\Categorizable;
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
||||
|
||||
class Article extends Model implements HasMedia
|
||||
{
|
||||
use Categorizable;
|
||||
use Taggable;
|
||||
use HasMediaTrait;
|
||||
use EloquentJoin;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_articles';
|
||||
|
||||
public function Family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Family');
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily','article_family_id');
|
||||
}
|
||||
|
||||
public function Inventories()
|
||||
|
||||
@@ -52,8 +52,11 @@ class ArticleAttributes
|
||||
return ArticleAttribute::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
dump($data);
|
||||
exit;
|
||||
$id = isset($data['id']) ? $id : $data['id'];
|
||||
return ArticleAttribute::find($id)->update($data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user