fix post crud

This commit is contained in:
2024-07-26 11:57:05 +03:00
parent 25e585655c
commit f5f546ba95
10 changed files with 42 additions and 38 deletions

View File

@ -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' => 'Обновлен'
];

View File

@ -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',
];
}
}