Commit f8a698ff by Aan Choesni Herlingga

jika kategori dihapus pada post index

parent 1fb09616
......@@ -35,11 +35,11 @@ class PostRepository extends Repository
return DataTables::of($data)
->addIndexColumn()
->addColumn('action', function ($row) {
$btn = '<a href="' . url('/webprofile/posts/' . $row->id . '/edit') . '" data-toggle="tooltip" data-id="' . $row->id . '" data-original-title="' . trans('label.edit') . '" class="edit btn btn-warning btn-round btn-sm edit">' . trans('label.edit') . '</a>';
$btn = '<a href="'.url('/webprofile/posts/'.$row->id.'/edit').'" data-toggle="tooltip" data-id="'.$row->id.'" data-original-title="'.trans('label.edit').'" class="edit btn btn-warning btn-round btn-sm edit">'.trans('label.edit').'</a>';
$btn = $btn . ' <a href="javascript:void(0)" data-toggle="tooltip" data-id="' . $row->id . '" data-original-title="' . trans('label.delete') . '" class="btn btn-danger btn-round btn-sm delete">' . trans('label.delete') . '</a>';
$btn = $btn.' <a href="javascript:void(0)" data-toggle="tooltip" data-id="'.$row->id.'" data-original-title="'.trans('label.delete').'" class="btn btn-danger btn-round btn-sm delete">'.trans('label.delete').'</a>';
$btn = $btn . '<br>';
$btn = $btn.'<br>';
return $btn;
})
......@@ -49,38 +49,42 @@ class PostRepository extends Repository
} else {
$str = '<div style="color: red;"><i class="fa fa-times"></i></div>';
}
return $str;
})
->addColumn('category', function ($row) {
$str = '';
if ($row->rCategory) {
$str = $row->rCategory->name;
}
return $str;
})
->addColumn('post_date', function ($row) {
$str = '';
if($row->post_status == 1) {
$str .= '<div style="color: green;">' . trans('label.publish') . '</div>';
if ($row->post_status == 1) {
$str .= '<div style="color: green;">'.trans('label.publish').'</div>';
}
if($row->post_status == 0) {
$str .= '<div style="color: red;">' . trans('label.draft') . '</div>';
if ($row->post_status == 0) {
$str .= '<div style="color: red;">'.trans('label.draft').'</div>';
}
$str .= Date('d-m-Y', strtotime($row->post_date));
$str .= date('d-m-Y', strtotime($row->post_date));
return $str;
})
->addColumn('sum', function ($row) {
$str = trans('label.viewer') . ' : ' . $row->viewer . '<br>';
$str .= trans('label.command') . ' : ' . $row->comment_count;
$str = trans('label.viewer').' : '.$row->viewer.'<br>';
$str .= trans('label.command').' : '.$row->comment_count;
return $str;
})
->addColumn('title', function ($row) {
$str = $row->title . '<br>';
$str = $row->title.'<br>';
if ($row->rEn) {
$str .= '<i style="color: blue;">' . $row->rEn['title'] . '</i>';
$str .= '<i style="color: blue;">'.$row->rEn['title'].'</i>';
}
return $str;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment