-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PHPDoc for model relationships (#106)
- Loading branch information
Showing
5 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/** | ||
* @return DummyReturn | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
/** | ||
* @property int $id | ||
* @property int $post_id | ||
* @property int $author_id | ||
* @property \Carbon\Carbon $created_at | ||
* @property \Carbon\Carbon $updated_at | ||
*/ | ||
class Comment extends Model | ||
{ | ||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'post_id', | ||
'author_id', | ||
]; | ||
|
||
/** | ||
* The attributes that should be cast to native types. | ||
* | ||
* @var array | ||
*/ | ||
protected $casts = [ | ||
'id' => 'integer', | ||
'post_id' => 'integer', | ||
'author_id' => 'integer', | ||
]; | ||
|
||
|
||
/** | ||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
*/ | ||
public function post() | ||
{ | ||
return $this->belongsTo(\App\Post::class); | ||
} | ||
|
||
/** | ||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
*/ | ||
public function author() | ||
{ | ||
return $this->belongsTo(\App\User::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters