Media youtube, title description, CMS Info Content / Header Frontend
This commit is contained in:
parent
c9f3d85d4e
commit
7294ccc1d0
49 changed files with 1283 additions and 148 deletions
62
app/Models/CMSInfoAvailable.php
Normal file
62
app/Models/CMSInfoAvailable.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\Models\CMSInfoAvailable
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $type
|
||||
* @property bool $active
|
||||
* @property string|null $from
|
||||
* @property string|null $to
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSInfoAvailable newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSInfoAvailable newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSInfoAvailable query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSInfoAvailable whereActive($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSInfoAvailable whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSInfoAvailable whereFrom($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSInfoAvailable whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSInfoAvailable whereTo($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSInfoAvailable whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSInfoAvailable whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int $wday
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSInfoAvailable whereWday($value)
|
||||
*/
|
||||
class CMSInfoAvailable extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
protected $table = 'c_m_s_info_availables';
|
||||
|
||||
protected $fillable = [
|
||||
'type', 'wday', 'active', 'from', 'to'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'active' => 'bool',
|
||||
];
|
||||
|
||||
|
||||
public static function getContentBySlug($type, $wday){
|
||||
return CMSInfoAvailable::whereType($type)->whereWday($wday)->first();
|
||||
}
|
||||
|
||||
public static function setContentBySlug($type, $wday, $values){
|
||||
|
||||
$content = CMSInfoAvailable::whereType($type)->whereWday($wday)->first();
|
||||
if(!$content) {
|
||||
$content = CMSInfoAvailable::create([
|
||||
'type' => $type,
|
||||
'wday' => $wday,
|
||||
]);
|
||||
}
|
||||
$content->fill($values);
|
||||
$content->save();
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue