mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
Update Laravel to 7.0
This commit is contained in:
45
app/News.php
45
app/News.php
@@ -4,6 +4,35 @@ namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\News
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $title
|
||||
* @property string $body
|
||||
* @property int $user_id
|
||||
* @property int $publish
|
||||
* @property array $tags
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Log[] $logs
|
||||
* @property-read int|null $logs_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Picture[] $pictures
|
||||
* @property-read int|null $pictures_count
|
||||
* @property-read \App\User $user
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\News newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\News newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\News query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereBody($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\News wherePublish($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereTags($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereTitle($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class News extends Model
|
||||
{
|
||||
protected $casts = [
|
||||
@@ -30,14 +59,11 @@ class News extends Model
|
||||
|
||||
$news = \App\News::all();
|
||||
|
||||
foreach (\App\Event::future() as $event)
|
||||
foreach (\App\Event::all() as $event)
|
||||
{
|
||||
if($event->type == 1 && $event->msg != "")
|
||||
if($event->use_weekly_msg == 1)
|
||||
{
|
||||
if (date('U',strtotime($event->date_msg)) <= time())
|
||||
{
|
||||
$news->push(self::getWeeklyMsg($event));
|
||||
}
|
||||
$news->push(self::getWeeklyMsg($event));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,13 +76,16 @@ class News extends Model
|
||||
|
||||
$n->event_id = $event->id;
|
||||
$n->title = 'Message de la semaine du '.date('Y-m-d',strtotime($event->date_begin));
|
||||
$n->body = $event->msg;
|
||||
$n->body = $event->desc;
|
||||
$n->user_id = $event->user_id;
|
||||
$n->publish = 1;
|
||||
$n->created_at = $event->created_at;
|
||||
$n->updated_at = $event->updated_at;
|
||||
$n->tags = ['message de la semaine','Important'];
|
||||
|
||||
if ($event->weekly_msg_file != null)
|
||||
{
|
||||
$n->files = $event->weekly_msg_file;
|
||||
}
|
||||
return $n;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user