crocodic-studio /
crudbooster
| 1 | <?php namespace crocodicstudio\crudbooster\controllers; |
||||
| 2 | |||||
| 3 | use CRUDBooster; |
||||
|
0 ignored issues
–
show
|
|||||
| 4 | use Illuminate\Support\Facades\DB; |
||||
| 5 | use Illuminate\Support\Facades\Excel; |
||||
|
0 ignored issues
–
show
The type
Illuminate\Support\Facades\Excel was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 6 | use Illuminate\Support\Facades\PDF; |
||||
|
0 ignored issues
–
show
The type
Illuminate\Support\Facades\PDF was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 7 | |||||
| 8 | class NotificationsController extends CBController |
||||
| 9 | { |
||||
| 10 | public function cbInit() |
||||
| 11 | { |
||||
| 12 | $this->table = "cms_notifications"; |
||||
| 13 | $this->primary_key = "id"; |
||||
| 14 | $this->title_field = "content"; |
||||
| 15 | $this->limit = 20; |
||||
| 16 | $this->index_orderby = ["id" => "desc"]; |
||||
|
0 ignored issues
–
show
|
|||||
| 17 | $this->button_show = true; |
||||
| 18 | $this->button_add = false; |
||||
| 19 | $this->button_delete = true; |
||||
| 20 | $this->button_export = false; |
||||
| 21 | $this->button_import = false; |
||||
| 22 | $this->global_privilege = true; |
||||
| 23 | |||||
| 24 | $read_notification_url = url(config('crudbooster.ADMIN_PATH')).'/notifications/read'; |
||||
|
0 ignored issues
–
show
Are you sure
url(config('crudbooster.ADMIN_PATH')) of type Illuminate\Contracts\Routing\UrlGenerator|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 25 | |||||
| 26 | $this->col = []; |
||||
| 27 | $this->col[] = ["label" => "Content", "name" => "content", "callback_php" => '"<a href=\"'.$read_notification_url.'/$row->id\">$row->content</a>"']; |
||||
| 28 | $this->col[] = [ |
||||
| 29 | 'label' => 'Read', |
||||
| 30 | 'name' => 'is_read', |
||||
| 31 | 'callback_php' => '($row->is_read)?"<span class=\"label label-default\">Already Read</span>":"<span class=\"label label-danger\">NEW</span>"', |
||||
| 32 | ]; |
||||
| 33 | |||||
| 34 | $this->form = []; |
||||
| 35 | $this->form[] = ["label" => "Content", "name" => "content", "type" => "text"]; |
||||
| 36 | $this->form[] = ["label" => "Icon", "name" => "icon", "type" => "text"]; |
||||
| 37 | $this->form[] = ["label" => "Notification Command", "name" => "notification_command", "type" => "textarea"]; |
||||
| 38 | $this->form[] = ["label" => "Is Read", "name" => "is_read", "type" => "text"]; |
||||
| 39 | } |
||||
| 40 | |||||
| 41 | public function hook_query_index(&$query) |
||||
| 42 | { |
||||
| 43 | $query->where('id_cms_users', CRUDBooster::myId()); |
||||
| 44 | } |
||||
| 45 | |||||
| 46 | public function getLatestJson() |
||||
| 47 | { |
||||
| 48 | |||||
| 49 | $rows = DB::table('cms_notifications')->where('id_cms_users', 0)->orWhere('id_cms_users', CRUDBooster::myId())->orderby('id', 'desc')->where('is_read', 0)->take(25); |
||||
| 50 | if (\Schema::hasColumn('cms_notifications', 'deleted_at')) { |
||||
| 51 | $rows->whereNull('deleted_at'); |
||||
| 52 | } |
||||
| 53 | |||||
| 54 | $total = count($rows->get()); |
||||
| 55 | |||||
| 56 | return response()->json(['items' => $rows->get(), 'total' => $total]); |
||||
| 57 | } |
||||
| 58 | |||||
| 59 | public function getRead($id) |
||||
| 60 | { |
||||
| 61 | DB::table('cms_notifications')->where('id', $id)->update(['is_read' => 1]); |
||||
| 62 | $row = DB::table('cms_notifications')->where('id', $id)->first(); |
||||
| 63 | |||||
| 64 | return redirect($row->url); |
||||
| 65 | } |
||||
| 66 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths