admin slider

This commit is contained in:
merdan 2020-04-06 17:47:48 +05:00
parent 307959830d
commit eb720104bf
3 changed files with 23 additions and 8 deletions

View File

@ -34,10 +34,10 @@ class SliderCrudController extends CrudController
// TODO: remove setFromDb() and manually define Fields and Columns
$this->crud->addColumns([
['name' => 'title','type' => 'text', 'label' => 'Title En'],
// ['name' => 'title','type' => 'text', 'label' => 'Title En'],
['name' => 'title_ru','type' => 'text', 'label' => 'Title Ru'],
['name' => 'title_tk','type' => 'text', 'label' => 'Title Tk'],
['name' => 'text','type' => 'text', 'label' => 'Text En'],
// ['name' => 'text','type' => 'text', 'label' => 'Text En'],
['name' => 'text_ru','type' => 'text', 'label' => 'Text Ru'],
['name' => 'text_tk','type' => 'text', 'label' => 'Text Tk'],
['name' => 'link','type' => 'text', 'label' => 'Link'],
@ -47,8 +47,10 @@ class SliderCrudController extends CrudController
['name' => 'image','type' => 'text', 'label' => 'Image'],
]);
$this->crud->addFields([
['name' => 'title','type' => 'text', 'label' => 'Title'],
['name' => 'text','type' => 'text', 'label' => 'Text'],
['name' => 'title_ru','type' => 'text', 'label' => 'Title Ru'],
['name' => 'title_tk','type' => 'text', 'label' => 'Title Tk'],
['name' => 'text_ru','type' => 'summernote', 'label' => 'Text Ru'],
['name' => 'text_tk','type' => 'summernote', 'label' => 'Text Tk'],
['name' => 'link','type' => 'text', 'label' => 'Link'],
['name' => 'ru','type' => 'checkbox', 'label' => 'Russian'],
['name' => 'tk','type' => 'checkbox', 'label' => 'Turkmen'],

View File

@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\CrudTrait;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Str;
class Slider extends Model
@ -36,6 +37,7 @@ class Slider extends Model
\Storage::disk('local')->delete($obj->image);
});
}
/*
|--------------------------------------------------------------------------
| RELATIONS
@ -53,6 +55,16 @@ class Slider extends Model
| ACCESORS
|--------------------------------------------------------------------------
*/
public function getTitleAttribute(){
return $this->{'title_'.Config::get('app.locale')}??'#title_transation';
}
public function getTextAttribute(){
return $this->{'text_'.Config::get('app.locale')}??'#title_transation';
}
public function setImageAttribute($value)
{
$attribute_name = "image";

View File

@ -13,16 +13,17 @@
data-masterspeed="default"
data-rotate="0"
data-saveperformance="off"
data-title="Slide"
data-param1="asdadasdasdasdasdasdas"
data-description="">
data-title="{{$slider->title}}">
<!-- Parallax Image -->
<div class="divimage dzsparallaxer--target w-100"
style="position:absolute; top: 0; background-position: center center;
background-size: cover; bottom: -100px; background-image:
url({{asset($slider->image)}}); transform: unset !important;"></div>
<!-- End Parallax Image -->
<a href="" class="d-block container g-py-200 h-100"></a>
<div>
{{$slider->text}}
</div>
<a href="{{$slider->link ?? '#'}}" class="d-block container g-py-200 h-100"></a>
</li>
</div>