Completed
Push — master ( ed6e58...b3a5f7 )
by Davide
10:21
created

Post::postsByCategory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace DavideCasiraghi\LaravelSmartBlog\Models;
4
5
use Dimsav\Translatable\Translatable;
6
use Illuminate\Database\Eloquent\Model;
7
8
class Post extends Model
9
{
10
    /***************************************************************************/
11
    /**
12
     * The table associated with the model.
13
     *
14
     * @var string
15
     */
16
    protected $table = 'posts';
17
18
    /***************************************************************************/
19
20
    use Translatable;
0 ignored issues
show
introduced by
The trait Dimsav\Translatable\Translatable requires some properties which are not provided by DavideCasiraghi\LaravelSmartBlog\Models\Post: $translations, $useTranslationFallback, $translationModel, $localeKey, $translationForeignKey
Loading history...
21
22
    public $translatedAttributes = ['title', 'intro_text', 'body', 'slug', 'before_content', 'after_content', 'extra_field_trans_1', 'extra_field_trans_2'];
23
    protected $fillable = ['author_id', 'category_id', 'meta_description', 'meta_keywords', 'seo_title', 'image', 'status', 'featured', 'introimage_src', 'introimage_alt', 'extra_field_1', 'extra_field_2', 'extra_field_3'];
24
25
    /***************************************************************************/
26
27
    /**
28
     * Return all the posts by category id in the language specified.
29
     *
30
     * @param  int $cat_id
31
     * @return \DavideCasiraghi\LaravelSmartBlog\Models\Post
32
     */
33
    /*public static function postsByCategory($cat_id)
34
    {
35
        $ret = self::
36
               where('category_id', $cat_id)
37
               ->get();
38
39
        return $ret;
40
    }*/
41
}
42