count();
}
public function actionIndex(): void
{
foreach (User::all() as $user)
{
echo $user->username . "
";
}
}
public function actionView($id): void
{
echo User::where('id', '=', $id)->get();
echo User::where('id', '=', $id)->first() . "
";
$user = User::find($id);
echo $user->id . "
";
echo $user->username . "
";
echo $user->email . "
";
echo $user->created_at . "
";
echo $user->updated_at . "
";
}
public function actionUpdate(): void
{
Debug::prn("Update");
require "app/views/userUpdate.php";
}
public function actionEdit(): void
{
$user = User::find($_REQUEST['id']);
$user->username = $_REQUEST['username'];
$user->email = $_REQUEST['email'];
$user->password = $_REQUEST['password'];
$user->save();
}
public function actionDelete($id): void
{
User::find($id)->delete();
}
}