component css class

This commit is contained in:
merdan 2021-05-01 19:01:36 +05:00
parent 6982755930
commit b30f1a71d2
2 changed files with 6 additions and 4 deletions

View File

@ -69,7 +69,7 @@ class Advertisement extends ComponentBase
}
public function onDisplay(){
$random = $this->property('random');
$random = input('random');
$this->page['group'] = $group = Group::where('code',$this->property('code'))
->with(['adds' => function ($query) use ($random){
if($random)
@ -78,7 +78,7 @@ class Advertisement extends ComponentBase
$query->orderBy('order');
}])
->first();
$this->page['css_class'] = $this->property('css_class','blat');
$this->page['css_class'] = input('css_class','blat');
if ($group && $group->adds){
try {
DB::beginTransaction();

View File

@ -1,7 +1,9 @@
<div id="{{__SELF__}}" class="{{__SELF__.property('css_class')}}" data-title="{{__SELF__.css_class}}"></div>
<div id="{{__SELF__}}" class="{{__SELF__.property('css_class')}}"></div>
{% put scripts %}
<script>
$.request('{{__SELF__}}::onDisplay')
$.request('{{__SELF__}}::onDisplay',{
data:{random:{{__SELF__.property('random')}},css_class:{{__SELF__.property('css_class')}}}
});
</script>
{% endput %}