Something went wrong. Try again.
My earliest code I have saved
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576<?php
namespace ConnectU\Models;
use Auth;use Illuminate\Database\Eloquent\Model;
class Status extends Model{ /** * The database table used by the model. * * @var string */ protected $table = 'statuses';
/** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'body', ];
/** * Gets the user that the status belongs to * * Uses a belongsTo relationship to determine what user the status belongs To * * @return void */ public function user() { return $this->belongsTo('ConnectU\Models\User', 'user_id'); }
/** * Gets every status that is not a reply * * Checks to see that the 'parent_id' is NULL (That means that it is not a reply) * * @return void */ public function scopeNotReply($query) { return $query->whereNull('parent_id'); }
/** * Gets all statuses that are replies * * Gets the statuses that are replies and that parent_id is not NULL using * a hasMany relationship * * @return void */ public function replies() { return $this->hasMany('ConnectU\Models\Status', 'parent_id'); }
/** * Gets the likes of a status * * Uses a morphMany polymorph to determine what likes that is attached to the * Status. * * @return void */ public function likes() { return $this->morphMany('ConnectU\Models\Like', 'likeable'); }}