Skip to content

Instantly share code, notes, and snippets.

@henriqueweiand
Created August 7, 2019 15:42
Show Gist options
  • Save henriqueweiand/2fc623f8c29acff5a4ac20a176a801a9 to your computer and use it in GitHub Desktop.
Save henriqueweiand/2fc623f8c29acff5a4ac20a176a801a9 to your computer and use it in GitHub Desktop.
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Messages extends Model {
protected $fillable = [
"id",
"user_id",
"description",
"created_at",
"updated_at"
];
public static $rules = [
"user_id" => "required|numeric|exists:users,id",
"description" => "required|max:255",
];
public function user()
{
return $this->belongsTo("App\Users");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment