blessing-skin-server/app/Models/Texture.php
Pig Fang 3cf19d8656
Apply fixes from StyleCI (#11)
This pull request applies code style fixes from an analysis carried out by [StyleCI](https://github.styleci.io).

---

For more information, click [here](https://github.styleci.io/analyses/8wKwbZ).
2019-03-02 22:58:37 +08:00

37 lines
693 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Texture extends Model
{
public $primaryKey = 'tid';
public $timestamps = false;
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'tid' => 'integer',
'likes' => 'integer',
'size' => 'integer',
'uploader' => 'integer',
'public' => 'boolean',
];
public function setPrivacy($public)
{
$this->public = $public;
return $this->save();
}
public function scopeLike($query, $field, $value)
{
return $query->where($field, 'LIKE', "%$value%");
}
}