Created
August 1, 2017 10:49
-
-
Save beyazitkolemen/ee7c06b43d1aa24222651f1f8d7d004a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Base Model | |
<?php | |
namespace App\Model; | |
use Dimsav\Translatable\Translatable; | |
use Illuminate\Database\Eloquent\Model; | |
class Ads extends Model | |
{ | |
use Translatable; | |
public $translatedAttributes = ['ads_description', 'ads_title', 'ads_slug']; | |
protected $fillable = ['ads_price', 'ads_price_type', 'ads_sale_type', 'shop_id', 'category_id', 'user_id', 'status']; | |
public $translationModel = 'App\Model\AdsTrans'; | |
} | |
// Translation Model | |
<?php | |
namespace App\Model; | |
use Illuminate\Database\Eloquent\Model; | |
use Cviebrock\EloquentSluggable\Sluggable; | |
class AdsTrans extends Model | |
{ | |
use Sluggable; | |
public $timestamps = false; | |
protected $fillable = ['ads_description', 'ads_title', 'ads_slug']; | |
public function sluggable() | |
{ | |
return [ | |
'ads_slug' => [ | |
'source' => 'ads_title' | |
] | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment