fix post crud
This commit is contained in:
@ -5,21 +5,22 @@ use \Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $post
|
||||
* @property string $username
|
||||
* @property string $content
|
||||
// * @property string $username
|
||||
* @property int $user_id
|
||||
* @method static where(int[] $array)
|
||||
* @method static find($id)
|
||||
*/
|
||||
class Post extends Model
|
||||
{
|
||||
protected $table = 'post';
|
||||
protected $fillable = ['post', 'username'];
|
||||
protected $fillable = ['content', 'user_id'];
|
||||
|
||||
public static function labels(): array
|
||||
{
|
||||
return [
|
||||
'post' => 'Пост',
|
||||
'username' => 'Пользователь',
|
||||
'content' => 'Контент',
|
||||
'user_id' => 'Id пользователя',
|
||||
'created_at' => 'Создан',
|
||||
'updated_at' => 'Обновлен'
|
||||
];
|
||||
|
@ -9,8 +9,8 @@ class CreatePostForm extends FormModel
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'post' => 'required|min-str-len:1|max-str-len:2048',
|
||||
'username' => 'required|min-str-len:1|max-str-len:50',
|
||||
'content' => 'required|min-str-len:1|max-str-len:2048',
|
||||
'user_id' => 'required|min-str-len:1',
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user