model()->with(['user:id,name,avatar,company_name','product:id,name,image','report:id,title']);
$grid->column('id')->sortable();
$grid->column('user_id')->display(function (){
$str = "";
if(!empty($this->user)){
$str .= "
";
$str .= '

';
$str .= '
';
$str .= '
' . $this->user->name . '
';
$str .= "
";
$str .= "
";
}
return $str;
});
$grid->column('product_id')->display(function (){
$str = "";
if(!empty($this->product)){
$str .= "";
$str .= '

';
$str .= '
';
$str .= '
' . $this->product->name . '
';
$str .= "
";
$str .= "
";
}
return $str;
});
$grid->column('report_id')->display(function (){
return $this->report->title;
});
$grid->column('created_at');
$grid->disableCreateButton();
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->like('id')->width(4);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new ReportLog(), function (Show $show) {
$show->field('id');
$show->field('user_id');
$show->field('product_id');
$show->field('report_id');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new ReportLog(), function (Form $form) {
$form->display('id');
$form->text('user_id');
$form->text('product_id');
$form->text('report_id');
$form->display('created_at');
$form->display('updated_at');
});
}
}